jQuery Slider - 在 Slider 外部滑动链接
我目前正在使用 Slidesjs.com 滑块,我希望这样当我单击滑块外部的链接时,它会滑动到当前幻灯片,例如单击幻灯片一张链接 (#1),它会滑动到幻灯片一张 (# 1) 在滑块内。这是我的编码,任何帮助将不胜感激。
$(function(){
// Set starting slide to 1
var startSlide = 1;
// Get slide number if it exists
if (window.location.hash) {
startSlide = window.location.hash.replace('#','');
}
// Initialize Slides
$('#passion_slider').slides({
autoHeight: true,
// Get the starting slide
start: startSlide,
animationComplete: function(current){
// Set the slide number as a hash
window.location.hash = '#' + current;
}
});
});
I'm currently using the slidesjs.com slider and I'm wanting to make it so when I click a link outside the slider it slides to the current slide e.g. click slide one link (#1) and it slides to slide one (#1) within the slider. Here is my coding any help would be much appreciated.
$(function(){
// Set starting slide to 1
var startSlide = 1;
// Get slide number if it exists
if (window.location.hash) {
startSlide = window.location.hash.replace('#','');
}
// Initialize Slides
$('#passion_slider').slides({
autoHeight: true,
// Get the starting slide
start: startSlide,
animationComplete: function(current){
// Set the slide number as a hash
window.location.hash = '#' + current;
}
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加到就绪事件。使用 target var 作为目标。
针对特定任务的解决方案!!!
在链接中添加点击触发器以直接显示特定幻灯片:
Add to ready event. Use target var for destination.
Solution for specific task!!!
Adding click trigger to links for direct showing specific slide: