Skip to content

Commit

Permalink
Handle all slick events
Browse files Browse the repository at this point in the history
  • Loading branch information
umpirsky committed Jun 6, 2015
1 parent 1d3215b commit 9b345ac
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/scripts/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ angular.module('slick', [])
if currentIndex?
sl.slideHandler(currentIndex)

slider.on 'reInit', (sl) ->
scope.onReInit() if attrs.onReInit

slider.on 'setPosition', (sl) ->
scope.onSetPosition() if attrs.onSetPosition

slider.on 'swipe', (sl) ->
scope.onSwipe() if attrs.onSwipe

slider.on 'afterChange', (event, slick, currentSlide, nextSlide) ->
scope.onAfterChange() if scope.onAfterChange

Expand All @@ -123,6 +132,18 @@ angular.module('slick', [])
scope.currentIndex = currentSlide
)

slider.on 'beforeChange', (sl) ->
scope.onBeforeChange() if attrs.onBeforeChange

slider.on 'breakpoint', (sl) ->
scope.onBreakpoint() if attrs.onBreakpoint

slider.on 'destroy', (sl) ->
scope.onDestroy() if attrs.onDestroy

slider.on 'edge', (sl) ->
scope.onEdge() if attrs.onEdge

scope.$watch("currentIndex", (newVal, oldVal) ->
if currentIndex? and newVal? and newVal != currentIndex
slider.slick('slickGoTo', newVal)
Expand Down

0 comments on commit 9b345ac

Please sign in to comment.