Ionic Scroll onMouseWheel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-content mouse-wheel-scroll> | |
<ion-list> | |
<ion-item | |
class="" | |
collection-repeat="chapter in chapters" | |
collection-item-width="'100%'" | |
collection-item-height="50" | |
style="width:100%;height:50px;" | |
ng-href="{{comic && chapter && urlFor.Reader(providerKey, comic, chapter)}}" | |
> | |
{{chapter.title}} | |
<span class="item-note"><time>{{chapter.updated | date:'short'}}</time> – #{{chapter.index}}</span> | |
</ion-item> | |
</ion-list> | |
</ion-content> | |
</ion-view> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment