0
JS Fiddle
Original Idea/Another version of this questionURL哈希滑塊
注意! 其他版本的想法/原來的想法已經回答了,所以如果其他的版本爲你工作,你的歡迎:)
這個問題仍然是開放的
因此,這裏是我的新我有麻煩的想法。我想製作一個圖像滑塊。滑塊包含其中的所有圖像,並且當頁面變成像#home這樣的散列時,我希望滑塊更新爲新圖像。滑塊處於浮動狀態。另一件事是我不希望它滾動傳遞其他圖像。我只是希望它直接滾動到該圖像。由於圖像寬度不同,我也需要垂直滾動。我感到不好,我基本上提出了工作要求,所以this是我認爲是正確的。如果有人告訴我我需要做什麼,我可以編寫代碼。
這是JS小提琴上的代碼。我只是有鏈接,以便它可以在被工作:
//This also need to execute when the hash is updated/an anchor link is clicked
window.onLoad = function hashLogo() {
var hash = window.location.hash;
//Image 1 Hashes
var image1 = [
'#image1',
'#home'
];
//Image 2 Hashes
var image2 = [
'#image2',
'#about'
];
if (image1.indexOf(hash) > -1) {
//Do jQuery Sliding
}
if (image2.indexOf(hash) > -1) {
//Do jQuery Sliding
}
};