我想在jquery中使用bootsraps carousel和平滑滚动。
下面是我制作平滑滚动的方法:
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 2000);
return false;
}
}
});我假设这段代码会阻止轮播按钮的功能。我怎样才能在不影响转盘按钮的情况下修改它呢?
请注意,我是一个完全的初学者在网络开发。
谢谢。
发布于 2016-02-15 05:38:16
如果我没理解错的话,我认为你可以做两件事中的一件:
例如,通过移除return false;在平滑滚动功能中的$('a').on('click.scroll', function() {…})
希望这能有所帮助!
https://stackoverflow.com/questions/35398055
复制相似问题