Javascript click.function与引导之间的冲突';旋转木马按钮
我想用jquery使用bootsraps carousel和平滑滚动 以下是我如何实现平滑滚动:Javascript click.function与引导之间的冲突';旋转木马按钮,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我想用jquery使用bootsraps carousel和平滑滚动 以下是我如何实现平滑滚动: $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname) { var target = $(thi
$('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;
}
}
});
我假设此代码阻止旋转木马按钮的功能。如何修改它,使其不影响旋转木马按钮
请注意,我是web开发的初学者
谢谢。如果我理解正确,我想你可以做两件事之一:
$('a')。在('click.scroll',function(){…})
return false,允许进入平滑滚动功能代码>
希望有帮助 更具体地说明
a
的父级,以避免旋转木马包装