0

大家好,我一直在关注我自己网站的 photoswipe 示例,但我无法使用 photoswipe 修复某些问题,画廊工作正常,但是当我选择画廊的一张图片时没有任何反应,幻灯片不显示,它只是重定向到图片; 这是我的代码的一部分:

        <!-- CSS Declaration -->
        <link rel="stylesheet" type="text/css" href="{site_url}jquerymobile/css/jquery.mobile-1.3.1.css" />
        <link rel="stylesheet" type="text/css" href="{site_url}jquerymobile/css/jquery.mobile.structure-1.3.1.css" />
        <link rel="stylesheet" type="text/css" href="{site_url}jquerymobile/css/jquery.mobile.theme-1.3.1.css" />
        <link rel="stylesheet" type="text/css" href="{site_url}photoswipe/css/photoswipe.css" />

        <link rel="stylesheet" type="text/css" href="{path='styles/m'}" />
    <script type="text/javascript" src="{site_url}jquerymobile/js/jquery.mobile-1.3.1.js"></script>

    <script type="text/javascript" src="{site_url}photoswipe/js/code.photoswipe.jquery-3.0.5.min.js"></script>
    <script type="text/javascript" src="{site_url}photoswipe/js/klass.min.js"></script>

一些进口。

        <div data-role="page" id="portfolio" >


            <div data-role="header" data-theme='a' id="header">
                <h1> Portfolio </h1>
            </div><!-- /header -->


            <div data-role="content" data-theme='c' >

            <div class="choice_list"> 
                <p> Our recent portfolio: </p>

                <ul data-role="listview" data-inset="true" >
                    <li>
                        <a href="#Gallery1" data-transition="slide"> 
                        <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn1"/>
                        <h3> Project#1</h3>
                        </a>
                    </li>
                    <li>
                        <a href="#Gallery2" data-transition="slide"> 
                        <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn2"/>
                        <h3> Project#2</h3>
                        </a>
                    </li>                   
                    <li>
                        <a href="#Gallery3" data-transition="slide"> 
                        <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn3"/>
                        <h3> Project#3</h3>
                        </a>
                    </li>
                    <li>
                        <a href="#Gallery4" data-transition="slide"> 
                        <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn4"/>
                        <h3> Project#4</h3>
                        </a>
                    </li>

                </ul>   

            </div>

            <p>For full view of our projects visit the normal website</p>

            <p class="copyright">Copyright &copy; MNT. Designed by <a href="http://www.mntdesign.co" class="ui-link">MNTDesign</a></p>


            </div><!-- /content -->

            <div data-role="footer" data-theme='a' >

                <nav data-role="navbar">
                    <ul>
                        <li><a href="{path='m'}" data-icon="home">Home</a></li>
                    </ul>
                </nav>

            </div><!-- /Foother -->

        </div><!-- /page -->

        <div data-role="page" id="Gallery1" class="gallery-page">
            <header data-role="header">
                <h1>Project #1</h1>
                <a href="#portfolio" data-icon="grid" data-iconpos="notext" data-transition="slide">Portfolio</a>
            </header>
            <!--<img src="" class="fullscreen" alt="projectn1" /> -->
            <div data-role="content">
                <ul class="gallery">
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn11" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn12" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn13" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn14" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                </ul>
                <p class="copyright">Copyright &copy; MNT. Designed by <a href="http://www.mntdesign.co" class="ui-link">MNTDesign</a></p>
            </div>
        </div><!-- Page Project #1 -->


        <div data-role="page" id="Gallery2" class="gallery-page">
            <header data-role="header">
                <h1>Project #2</h1>
                <a href="#portfolio" data-icon="grid" data-iconpos="notext" data-transition="slide">Portfolio</a>
            </header>
                <div data-role="content">
                <ul class="gallery">
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn21" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn22" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn23" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn24" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn25" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                    <li>
                        <a href="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" rel="external"> <!-- small picture -->
                            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn26" /> <!-- 200x130 px image -->
                        </a>
                    </li>
                </ul>
                <p class="copyright">Copyright &copy; MNT. Designed by <a href="http://www.mntdesign.co" class="ui-link">MNTDesign</a></p>
            </div>
        </div><!-- Page Project #2 -->


        <div data-role="page" id="Gallery3" >
            <header data-role="header">
                <h1>Project #3</h1>
                <a href="#portfolio" data-icon="grid" data-iconpos="notext" data-transition="slide">Portfolio</a>
            </header>
            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" class="fullscreen" alt="projectn3" />
        </div><!-- Page Project #3 -->

        <div data-role="page" id="Gallery4" >
            <header data-role="header">
                <h1>Project #4</h1>
                <a href="#portfolio" data-icon="grid" data-iconpos="notext" data-transition="slide">Portfolio</a>
            </header>
            <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" class="fullscreen" alt="projectn4" />
        </div><!-- Page Project #4 -->



    </body>

身体。

    (function(window, $, PhotoSwipe){
        $(document).ready(function(){
            $('div.gallery-page')
                .live('pageshow', function(e){
                    var currentPage = $(e.target),
                        options = {},
                        photoSwipeInstance = $("ul.gallery a", e.target).photoSwipe(options,  currentPage.attr('id'));
                    return true;    
                })
                .live('pagehide', function(e){
                    var currentPage = $(e.target),
                        photoSwipeInstance = PhotoSwipe.getInstance(currentPage.attr('id'));
                    if (typeof photoSwipeInstance != "undefined" && photoSwipeInstance != null) {
                        PhotoSwipe.detatch(photoSwipeInstance);
                    }
                    return true;
                });
        });
    }(window, window.jQuery, window.Code.PhotoSwipe));

剧本。

mi 对 coda 的看法 http://img844.imageshack.us/img844/5346/r6m.png

我如何在 coda 上保存文件(我不知道照片滑动图像应该在哪里,我在不同的地方尝试过)

关于我做错了什么的任何线索?

我真的很感激你能给我的每一个帮助!


编辑:

调试

mi view on firefox firebug

我使用photoswipe示例中的脚本,并且在本地可以完美地处理示例,但是当它将文件上传到服务器和我的应用程序代码时,我不知道是否需要更改某些内容,或者什么不支持我的表达式引擎javascript代码。

4

1 回答 1

0

我发现了问题,上次更新 jquery .live 不起作用,我将其更改为 .on 并且它起作用了!

      (function(window, $, PhotoSwipe){
            $(document).ready(function(){
                $('div.gallery-page')
                    .on('pageshow', function(e){
                        var 
                            currentPage = $(e.target),
                            options = {},
                            photoSwipeInstance = $("ul.gallery a", e.target).photoSwipe(options,  currentPage.attr('id'));
                        return true;    
                    })
                    .on('pagehide', function(e){
                        var 
                            currentPage = $(e.target),
                            photoSwipeInstance = PhotoSwipe.getInstance(currentPage.attr('id'));
                        if (typeof photoSwipeInstance != "undefined" && photoSwipeInstance != null) {
                            PhotoSwipe.detatch(photoSwipeInstance);
                        }
                        return true;
                    });
            });
        }(window, window.jQuery, window.Code.PhotoSwipe));

和文件夹图像,应与 htmls 文件位于同一文件夹中。

于 2013-06-25T23:02:23.813 回答