尼斯滚动问题

时间:2014-04-25 09:24:10

标签: jquery nicescroll

我正在为niceScroll使用此函数,但它在Safari中无效。但是,它在Firefox,Chrome甚至IE中运行良好。我该如何解决这个问题?

jQuery(function($) {
    $(document).ready(function()
    {
      $(".tableClass").niceScroll();
    });
 });

2 个答案:

答案 0 :(得分:0)

jQuery Nicescroll 3.6.0中存在一些问题。这就是为什么它在野生动物园中不能正常工作的原因。现在他们解决了。下载最新版本。 jQuery Nicescroll 3.6.7并使用它。我认为它可以在所有浏览器中正常工作。

答案 1 :(得分:-1)

抱歉,我知道这不会直接回答您的问题,但可以帮助您实现您想要实现的目标。您尝试使用niceScroll插件实现了哪些功能?

如果在锚标签上平滑滚动,则可以执行以下操作:

$(function() {
  $('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;
      }
    }
  });
});

http://css-tricks.com/snippets/jquery/smooth-scrolling/

否则,如果在向下滚动页面时软化滚动效果,则可以执行以下操作:

$(document).ready(function() {
    var page = $('#content');  // set to the main content of the page   
    $(window).mousewheel(function(event, delta, deltaX, deltaY){
        if (delta < 0) page.scrollTop(page.scrollTop() + 65);
        else if (delta > 0) page.scrollTop(page.scrollTop() - 65);
        return false;
    })
});

jquery vertical mousewheel smooth scrolling

这两种解决方案都是跨浏览器兼容的。

相关问题