【问题标题】:Bug with Photoswipe in jQuery Mobile? Popups not showing in certain casesjQuery Mobile 中的 Photoswipe 错误?在某些情况下不显示弹出窗口
【发布时间】:2012-12-21 09:11:30
【问题描述】:

我的照片滑动库工作正常,我只有一个问题:

案例1: 在#about 上输入#gallery 后,我可以点击一张照片,查看并关闭它,然后点击返回按钮将我带到#about。 #about 包括一个可以查看的弹出图像。这样一切正常

案例2: 在#about 上进入#gallery 后,所有可用的照片都会出现。但是当我不点击一个而只是点击后退按钮时,虽然浏览器的 url 将 &ui-state=dialog 添加到了 url,但 #about 弹出窗口不会显示

这很奇怪。这是我的 photoswipe js 代码:

(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));

  • 的 photswipe 元素将以这种方式添加:
    $('#galleryContent').append('<li><a href="XXX" rel="external"><img src="XXX" width="150"  /></a></li>');
    

    这是画廊:

    <div data-role="page" id="gallery" class="gallery-page" data-add-back-btn="true">
    
    <div data-role="header" data-theme="b">
        <h1>Images</h1>
    </div>
    
    <div data-role="content" data-theme="a">    
    
        <ul class="gallery" id="galleryContent">    
        </ul>
    
    </div>
    
    <div data-role="footer" data-theme="b">
        <h4>xxx</h4>
    </div>
    

  • 【问题讨论】:

    • 我也有同样的问题。你找到解决办法了吗?

    标签: jquery jquery-mobile photoswipe


    【解决方案1】:

    此问题已在 PhotoSwipe 的主版本中修复,地址为 https://github.com/codecomputerlove/PhotoSwipe

    下载主版本并运行 build.sh 脚本生成版本 3.0.5.1。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-16
      • 1970-01-01
      相关资源
      最近更新 更多