Skip to content

Instantly share code, notes, and snippets.

Last active April 29, 2017 18:26
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Ionic Scroll onMouseWheel
app.directive 'mouseWheelScroll', ($timeout) ->
return {
restrict: 'A'
# require: '^$ionicScroll'
link: ($scope, $element, $attrs) ->
scrollCtrl = $element.controller('$ionicScroll')
console.log scrollCtrl
unless scrollCtrl
return console.error('mouseWheelScroll must be attached to a $ionicScroll controller.')
onMouseWheel = (e) ->
scrollCtrl.scrollBy 0, -e.wheelDeltaY, false
# halfHeight = scrollCtrl.element.clientHeight / 2
# deltaY = if e.wheelDeltaY > 0 then 1 else -1
# deltaY = halfHeight * deltaY
# scrollCtrl.scrollBy 0, -deltaY, false
scrollCtrl.element.addEventListener 'wheel', onMouseWheel
<ion-content mouse-wheel-scroll>
collection-repeat="chapter in chapters"
ng-href="{{comic && chapter && urlFor.Reader(providerKey, comic, chapter)}}"
<span class="item-note"><time>{{chapter.updated | date:'short'}}</time> – #{{chapter.index}}</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment