Javascript 平滑滚动干扰引导转盘

Javascript 平滑滚动干扰引导转盘,javascript,jquery,html,css,carousel,Javascript,Jquery,Html,Css,Carousel,我正在做一个项目,需要从导航栏平滑滚动。 这是平滑滚动代码: $(function() { // Smooth Scrolling **$('a[href*="#"]:not([href="#"])')**.click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostna

我正在做一个项目,需要从导航栏平滑滚动。 这是平滑滚动代码:

 $(function() {
  // Smooth Scrolling
  **$('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
        }, 1000);
        return false;
      }
    }
  });
});
但我也在我的网站上使用一个引导旋转木马,它有左右两个控件,并有如下类似的href,可以更改旋转木马中的图像:

<a class="left carousel-control" **href="#myCarousel**" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
      <span class="sr-only">Next</span>
    </a>


现在,我不能仅仅因为href问题而停止使用平滑滚动效果,就像我在旋转木马中单击左侧或右侧控件时一样,由于平滑滚动中的href功能,整个页面会下降,旋转木马中的图像不会更改为下一个图像。对此,可能的解决方案是什么?

只需在下面的行中添加另一个参数,如下所示:

$('a[href*="#"]:not([href="#"]):not([href="#myCarousel"])').click(function() {
    //your function
}