In Ionic, how to disable vertical scrolling while swiping left?

后端 未结 4 869
野趣味
野趣味 2021-02-06 18:21

I am making a Ionic mobile app, whose main view is a vertical list of cards. I want each card to be \"swipable\", in the same way as Google Now cards.

I started to imple

4条回答
  •  萌比男神i
    2021-02-06 18:43

    Another approach uses $ionicScrollDelegate to enable/disable vertical scrolling when needed.

    So, for example, in each add on-drag-left and on-drag-right event handlers:

        

    In those handlers $ionicScrollDelegate is used as in code below:

      $scope.disableVerticalScrolling = function() {
        $ionicScrollDelegate.getScrollView().options.scrollingY = false;
      }
    
      $scope.enableVerticalScrolling = function() {
        $ionicScrollDelegate.getScrollView().options.scrollingY = true;
      }
    

    These functions are also called when finished some operations done by option buttons (i.e. edit, delete, share, ...).

    Here is an example showing this approach:

    http://codepen.io/beaver71/pen/XXVzXa?editors=101

提交回复
热议问题