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
}
};