zoukankan      html  css  js  c++  java
  • 判断鼠标滚动方向

    #第一种

        return if !$state.is 'public.home'
            toolbar = $('.js-article-toolbar')
            $scope.oldToolbarPos = 0 if !$scope.oldToolbarPos && $scope.oldToolbarPos != 0
            scrollTop = $(_this).scrollTop()
            $timeout.cancel $scope.headroomTimer
            $scope.headroomTimer = $timeout ->
              if scrollTop > $scope.oldToolbarPos
                #向上

        toolbar.removeClass('slideInDown').addClass('slideOutUp')
              else

               #向下
                toolbar.removeClass('slideOutUp').addClass('slideInDown')

              $scope.oldToolbarPos = scrollTop
            , 50, false

    #第二种

    # $(window).on 'mousewheel DOMMouseScroll', (e)->
          #   console.log '鼠标滚动方向:', e

          #   if e.originalEvent.wheelDelta #IE 谷歌
          #     _delta = parseInt e.originalEvent.wheelDelta
          #     if _delta > 0
          #       #向上
          #       console.log '向上', _delta
          #     else
          #       #向下
          #       console.log '向下', _delta
          #   else if e.originalEvent.detail #火狐
          #     _delta = parseInt e.originalEvent.detail
          #     if _delta > 0
          #       #向上
          #       console.log '向下', _delta
          #     else
          #       #向下
          #       console.log '向上', _delta

  • 相关阅读:
    查看kafka版本号
    This service allows sftp connections only. 解法
    raid5和raid10的异同
    mpstat命令
    力扣 2020.06.27
    力扣 2020.06.22
    windows10 LTSC 2019 激活
    shell 不等式的表示方法
    C#后台判断一个网站的有效性代码
    C#去除DataTable中的重复数值
  • 原文地址:https://www.cnblogs.com/wanqiu/p/5306546.html
Copyright © 2011-2022 走看看