I've added anchor scrolling to my website, however because I've used anchors for elements in my carousel, every time I click on the carousel indicators, the page scrolls down a bit.
How can I disable those anchors from being included? This is my jquery:
$(document).ready(function(){$('a[href^="#"]').on("click",function(a){a.preventDefault(); var b=this.hash,c=$(b); $("html,body").stop().animate({scrollTop:c.offset().top},900,"swing",function(){window.location.hash=b})})});
Appreciate your help.
将它们从选择中删除,而不是。
$('a[href^="#"]').not(".YourCarousel a").on("click", ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.