【发布时间】: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));
$('#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