Моя фотогалерея работает нормально, у меня только одна проблема:
Случай 1: после входа в #галерея на #о, я могу щелкнуть фотографию, просмотреть и закрыть ее, а затем нажать кнопку «Назад», которая возвращает меня к #о. #about включает всплывающее изображение, которое можно просмотреть. Вот так все работает нормально
Случай 2: После входа в #галерея на #о нас есть все доступные фотографии. Но когда я не нажимаю кнопку, а просто нажимаю кнопку «Назад», которая приводит меня к #about, всплывающее окно не отображается, хотя URL-адрес браузера добавляет &ui-state=dialog к URL-адресу.
Это очень странно. Вот мой 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));
The
$('#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>