[英]Jump to specific slide by by clicking link on owl carousel
I have implemented owl carousel in my website. 我已经在网站上实现了猫头鹰轮播。 The Carousel Slides are related to the navigation menus. 轮播幻灯片与导航菜单相关。 That means when i will click one of the menus the carousel will show that specific slide. 这意味着当我单击菜单之一时,轮播将显示该特定幻灯片。 I tried it with to.owl.carousel
but is not working for me. 我尝试了to.owl.carousel
但对我不起作用。 I tried like- 我尝试过-
$('#award').click(function(){
$('#home').trigger('to.owl.carousel', 2)
});
where award
is the menu id and home
crousel id. 其中award
是菜单ID和home
容器ID。 2 is the position of the slide. 2是幻灯片的位置。
My website is http://tonitro.com/test/ 我的网站是http://tonitro.com/test/
How can i trigger this? 我该如何触发呢?
You can use the owl.goTo
event to slide your owl carousel to specific slide. 您可以使用owl.goTo
事件将您的猫头鹰轮播滑动到特定幻灯片。
$('#home').trigger('owl.goTo', 2)
Your problem is that you don't have element with id="award"
in your html, so $('#award').click
will not work. 您的问题是您的html中没有带有id="award"
元素,因此$('#award').click
无法正常工作。
If you want to trigger the slide when you click on the Award on the top menu you should change your html there to: 如果要在单击顶部菜单上的Award时触发幻灯片,则应将html更改为:
<li><a href="#portfolio" id="award">Awards</a></li>
So $('#award').click
will trigger click on that element 因此$('#award').click
将触发对该元素的点击
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.