我在jQuery Elastislide中有一個庫。哈希和數字
畫廊的每張圖片都有相應的哈希值。
例如:* www.example.com/gallery.html#4/title_of_the_picture *
所以,當我重新加載第四圖像,頁面加載第四圖像。
但是,當我重新加載沒有在哈希標題之前的數字,圖片不加載。
* 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));
});
}
}
有你'的init =功能)不關閉括號({'和'圖庫=(函數(){'功能 –