jQuery Elastislide にギャラリーがあります。
ギャラリーの各写真には、対応するハッシュがあります。
例: *www.example.com/gallery.html#4/title_of_the_picture*
したがって、4 番目の画像を再読み込みすると、ページは 4 番目の画像を読み込みます。
しかし、ハッシュのタイトルの前に番号なしでリロードすると、画像が読み込まれません。
*www.example.com/gallery.html#title_of_the_picture*
この番号を削除できますか? 可能であれば、Jquery で使用する正しいコードは何ですか?
jQuery コード:
Gallery = (function() {
// index of the current item
var imageIndex = 0;
if (window.location.hash) {
var imageIndexStr = window.location.hash.replace('#', ''); // remove #
imageIndex = parseInt(imageIndexStr, 0); // convert to int
}
var current = imageIndex;
// mode : carousel || fullview
mode = 'carousel',
// control if one image is being loaded
anim = false, init = function() {
// (not necessary) preloading the images here...
$items.add('<img src="ajax-loader.gif"/><img src="black.png"/>').imagesLoaded(function() {
// add options
_addViewModes();
// add large image wrapper
_addImageWrapper();
// show first image
_showImage($items.eq(current));
});
}
}