PhotoswipeGalleryで問題が発生しました。私が直面している問題は、サムネイルをクリックすると、ページ全体とそのコントロールが画像とともに読み込まれ、空白のページだけが表示されることです。
これは、標準のブラウザとChromeの両方で、私のモバイルデバイス(android 4.0.4)でのみ発生します。しかし、私のラップトップのFirefoxとChromeはどちらも正常に機能しています。
Chromeリモートデバッガーを接続しましたが、すべて正常に動作しているようです。
Chromeモバイルでは#&ui-state=dialog
、Android標準ブラウザ、デスクトップChrome、FirefoxではURLハッシュが変更されず、ハッシュが変更されずに表示されます#pageid
。
コードをデバッグしようとしましたが、何が悪いのかわかりません。
ギャラリーのマークアップはpagebeforechange
イベントに挿入されます。そして、Photoswipeは次のように初期化されます。
(function(window, $, PhotoSwipe){
$(document).ready(function(){
console.log('document ready')
$('div.gallery-page').live('pageshow', function(e){
console.log('pageshow');
var currentPage = $(e.target);
var options = { enableMouseWheel: false , enableKeyboard: false };
var photoSwipeInstance = $("ul.gallery a", e.target).photoSwipe(options, currentPage.attr('id'));
console.log(e.target);
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));
モバイルデバイスでのみ、ページが空白になる理由について何か考えはありますか?
//現在、pagebeforechangeイベントで回避策を編集しています:
if(window.location.hash.search(/ui-state=dialog/) !== -1 ) {
console.log('ui-state anomaly');
e.preventDefault();
}