Ion-scroll disable scroll until zoomed in


#1

I would like to disable scrolling in an ion-scroll until the user is zoomed in.

Can I bind an event to on-scroll?

Any idea?


#2

No need to answer this. I’ve figured it out.

Using a directive to detect pinch on the element and freezing the scroll.

`.directive(‘detectGestures’, function($ionicGesture) {
return {
restrict : ‘A’,

link : function(scope, elem, attrs) {
  var gestureType = attrs.gestureType;

  switch(gestureType) {
    case 'pinch':
      $ionicGesture.on('pinch', scope.reportEvent, elem);
      break;
  }

}

}
})
`

`$scope.reportEvent = function(event) {
//Pinch event - do what you want here.
};

`

Put this on the element you want to detect.

detect-gestures gesture-type="pinch"