diff --git a/bower.json b/bower.json index 1289851..cdcad68 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-slick-carousel", - "version": "3.1.3", + "version": "3.1.4", "homepage": "https://github.com/devmark/angular-slick-carousel", "authors": [ "DevMark " diff --git a/dist/angular-slick.js b/dist/angular-slick.js index c87d4c7..a8cf69c 100644 --- a/dist/angular-slick.js +++ b/dist/angular-slick.js @@ -2,7 +2,7 @@ * angular-slick-carousel * DevMark * https://github.com/devmark/angular-slick-carousel - * Version: 3.1.3 - 2015-11-25T09:13:43.590Z + * Version: 3.1.4 - 2015-12-26T03:01:55.410Z * License: MIT */ @@ -92,16 +92,16 @@ angular centerPadding: scope.centerPadding || '50px', cssEase: scope.cssEase || 'ease', customPaging: attr.customPaging ? function (slick, index) { - return scope.customPaging({ slick: slick, index: index }); + return scope.customPaging({slick: slick, index: index}); } : void 0, - dots: attr.dots || scope.dots === 'true', + dots: scope.dots === 'true', draggable: scope.draggable !== 'false', fade: scope.fade === 'true', focusOnSelect: scope.focusOnSelect === 'true', easing: scope.easing || 'linear', edgeFriction: scope.edgeFriction || 0.15, infinite: scope.infinite !== 'false', - initialSlide: scope.initialSlide || 0, + initialSlide: parseInt(scope.initialSlide) || 0, lazyLoad: scope.lazyLoad || 'ondemand', mobileFirst: scope.mobileFirst === 'true', pauseOnHover: scope.pauseOnHover !== 'false', @@ -143,7 +143,7 @@ angular var slickness = angular.element(element); if (angular.element(element).hasClass('slick-initialized')) { - if(options.enabled) { + if (options.enabled) { return slickness.slick('getSlick'); } else { destroy(); @@ -151,7 +151,7 @@ angular } else { angular.element(element).css('display', 'block'); - if(!options.enabled) { + if (!options.enabled) { return; } // Event @@ -163,7 +163,7 @@ angular return slick.slideHandler(currentIndex); } }); - $timeout(function() { + $timeout(function () { slickness.slick(options); }); } @@ -184,46 +184,62 @@ angular slickness.on('afterChange', function (event, slick, currentSlide, nextSlide) { currentIndex = currentSlide; if (typeof options.event.afterChange !== 'undefined') { - options.event.afterChange(event, slick, currentSlide, nextSlide); + scope.$apply(function () { + options.event.afterChange(event, slick, currentSlide, nextSlide); + }); } }); slickness.on('beforeChange', function (event, slick, currentSlide, nextSlide) { if (typeof options.event.beforeChange !== 'undefined') { - options.event.beforeChange(event, slick, currentSlide, nextSlide); + scope.$apply(function () { + options.event.beforeChange(event, slick, currentSlide, nextSlide); + }); } }); slickness.on('reInit', function (event, slick) { if (typeof options.event.reInit !== 'undefined') { - options.event.reInit(event, slick); + scope.$apply(function () { + options.event.reInit(event, slick); + }); } }); if (typeof options.event.breakpoint !== 'undefined') { slickness.on('breakpoint', function (event, slick, breakpoint) { - options.event.breakpoint(event, slick, breakpoint); + scope.$apply(function () { + options.event.breakpoint(event, slick, breakpoint); + }); }); } if (typeof options.event.destroy !== 'undefined') { slickness.on('destroy', function (event, slick) { - options.event.destroy(event, slick); + scope.$apply(function () { + options.event.destroy(event, slick); + }); }); } if (typeof options.event.edge !== 'undefined') { slickness.on('edge', function (event, slick, direction) { - options.event.edge(event, slick, direction); + scope.$apply(function () { + options.event.edge(event, slick, direction); + }); }); } if (typeof options.event.setPosition !== 'undefined') { slickness.on('setPosition', function (event, slick) { - options.event.setPosition(event, slick); + scope.$apply(function () { + options.event.setPosition(event, slick); + }); }); } if (typeof options.event.swipe !== 'undefined') { slickness.on('swipe', function (event, slick, direction) { - options.event.swipe(event, slick, direction); + scope.$apply(function () { + options.event.swipe(event, slick, direction); + }); }); } }; diff --git a/dist/angular-slick.min.js b/dist/angular-slick.min.js index 436083a..60a6fc4 100644 --- a/dist/angular-slick.min.js +++ b/dist/angular-slick.min.js @@ -2,7 +2,7 @@ * angular-slick-carousel * DevMark * https://github.com/devmark/angular-slick-carousel - * Version: 3.1.3 - 2015-11-25T09:13:43.590Z + * Version: 3.1.4 - 2015-12-26T03:01:55.410Z * License: MIT */ -"use strict";angular.module("slickCarousel",[]).constant("slickCarouselConfig",{method:{},event:{}}).directive("slick",["$timeout","slickCarouselConfig",function(e,n){var i,t;return i=["slickGoTo","slickNext","slickPrev","slickPause","slickPlay","slickAdd","slickRemove","slickFilter","slickUnfilter","unslick"],t=["afterChange","beforeChange","breakpoint","destroy","edge","init","reInit","setPosition","swipe"],{scope:{settings:"=",enabled:"@",accessibility:"@",adaptiveHeight:"@",autoplay:"@",autoplaySpeed:"@",arrows:"@",asNavFor:"@",appendArrows:"@",prevArrow:"@",nextArrow:"@",centerMode:"@",centerPadding:"@",cssEase:"@",customPaging:"&",dots:"@",draggable:"@",fade:"@",focusOnSelect:"@",easing:"@",edgeFriction:"@",infinite:"@",initialSlide:"@",lazyLoad:"@",mobileFirst:"@",pauseOnHover:"@",pauseOnDotsHover:"@",respondTo:"@",responsive:"=?",rows:"@",slide:"@",slidesPerRow:"@",slidesToShow:"@",slidesToScroll:"@",speed:"@",swipe:"@",swipeToSlide:"@",touchMove:"@",touchThreshold:"@",useCSS:"@",variableWidth:"@",vertical:"@",verticalSwiping:"@",rtl:"@"},restrict:"AE",link:function(t,o,s){angular.element(o).css("display","none");var r,a,l,d,u,c;return a=function(){r=angular.extend(angular.copy(n),{enabled:"false"!==t.enabled,accessibility:"false"!==t.accessibility,adaptiveHeight:"true"===t.adaptiveHeight,autoplay:"true"===t.autoplay,autoplaySpeed:null!=t.autoplaySpeed?parseInt(t.autoplaySpeed,10):3e3,arrows:"false"!==t.arrows,asNavFor:t.asNavFor?t.asNavFor:void 0,appendArrows:angular.element(t.appendArrows?t.appendArrows:o),prevArrow:t.prevArrow?angular.element(t.prevArrow):void 0,nextArrow:t.nextArrow?angular.element(t.nextArrow):void 0,centerMode:"true"===t.centerMode,centerPadding:t.centerPadding||"50px",cssEase:t.cssEase||"ease",customPaging:s.customPaging?function(e,n){return t.customPaging({slick:e,index:n})}:void 0,dots:s.dots||"true"===t.dots,draggable:"false"!==t.draggable,fade:"true"===t.fade,focusOnSelect:"true"===t.focusOnSelect,easing:t.easing||"linear",edgeFriction:t.edgeFriction||.15,infinite:"false"!==t.infinite,initialSlide:t.initialSlide||0,lazyLoad:t.lazyLoad||"ondemand",mobileFirst:"true"===t.mobileFirst,pauseOnHover:"false"!==t.pauseOnHover,pauseOnDotsHover:"true"===t.pauseOnDotsHover,respondTo:null!=t.respondTo?t.respondTo:"window",responsive:t.responsive||void 0,rows:null!=t.rows?parseInt(t.rows,10):1,slide:t.slide||"",slidesPerRow:null!=t.slidesPerRow?parseInt(t.slidesPerRow,10):1,slidesToShow:null!=t.slidesToShow?parseInt(t.slidesToShow,10):1,slidesToScroll:null!=t.slidesToScroll?parseInt(t.slidesToScroll,10):1,speed:null!=t.speed?parseInt(t.speed,10):300,swipe:"false"!==t.swipe,swipeToSlide:"true"===t.swipeToSlide,touchMove:"false"!==t.touchMove,touchThreshold:t.touchThreshold?parseInt(t.touchThreshold,10):5,useCSS:"false"!==t.useCSS,variableWidth:"true"===t.variableWidth,vertical:"true"===t.vertical,verticalSwiping:"true"===t.verticalSwiping,rtl:"true"===t.rtl},t.settings)},l=function(){var e=angular.element(o);return e.hasClass("slick-initialized")&&(e.remove("slick-list"),e.slick("unslick")),e},d=function(){a();var n=angular.element(o);if(angular.element(o).hasClass("slick-initialized")){if(r.enabled)return n.slick("getSlick");l()}else{if(angular.element(o).css("display","block"),!r.enabled)return;n.on("init",function(e,n){return"undefined"!=typeof r.event.init&&r.event.init(e,n),"undefined"!=typeof c?n.slideHandler(c):void 0}),e(function(){n.slick(r)})}t.internalControl=r.method||{},i.forEach(function(e){t.internalControl[e]=function(){var i;i=Array.prototype.slice.call(arguments),i.unshift(e),n.slick.apply(o,i)}}),n.on("afterChange",function(e,n,i,t){c=i,"undefined"!=typeof r.event.afterChange&&r.event.afterChange(e,n,i,t)}),n.on("beforeChange",function(e,n,i,t){"undefined"!=typeof r.event.beforeChange&&r.event.beforeChange(e,n,i,t)}),n.on("reInit",function(e,n){"undefined"!=typeof r.event.reInit&&r.event.reInit(e,n)}),"undefined"!=typeof r.event.breakpoint&&n.on("breakpoint",function(e,n,i){r.event.breakpoint(e,n,i)}),"undefined"!=typeof r.event.destroy&&n.on("destroy",function(e,n){r.event.destroy(e,n)}),"undefined"!=typeof r.event.edge&&n.on("edge",function(e,n,i){r.event.edge(e,n,i)}),"undefined"!=typeof r.event.setPosition&&n.on("setPosition",function(e,n){r.event.setPosition(e,n)}),"undefined"!=typeof r.event.swipe&&n.on("swipe",function(e,n,i){r.event.swipe(e,n,i)})},u=function(){l(),d()},o.one("$destroy",function(){l()}),t.$watch("settings",function(e,n){return null!==e?u():void 0},!0)}}}]); \ No newline at end of file +"use strict";angular.module("slickCarousel",[]).constant("slickCarouselConfig",{method:{},event:{}}).directive("slick",["$timeout","slickCarouselConfig",function(e,n){var i,t;return i=["slickGoTo","slickNext","slickPrev","slickPause","slickPlay","slickAdd","slickRemove","slickFilter","slickUnfilter","unslick"],t=["afterChange","beforeChange","breakpoint","destroy","edge","init","reInit","setPosition","swipe"],{scope:{settings:"=",enabled:"@",accessibility:"@",adaptiveHeight:"@",autoplay:"@",autoplaySpeed:"@",arrows:"@",asNavFor:"@",appendArrows:"@",prevArrow:"@",nextArrow:"@",centerMode:"@",centerPadding:"@",cssEase:"@",customPaging:"&",dots:"@",draggable:"@",fade:"@",focusOnSelect:"@",easing:"@",edgeFriction:"@",infinite:"@",initialSlide:"@",lazyLoad:"@",mobileFirst:"@",pauseOnHover:"@",pauseOnDotsHover:"@",respondTo:"@",responsive:"=?",rows:"@",slide:"@",slidesPerRow:"@",slidesToShow:"@",slidesToScroll:"@",speed:"@",swipe:"@",swipeToSlide:"@",touchMove:"@",touchThreshold:"@",useCSS:"@",variableWidth:"@",vertical:"@",verticalSwiping:"@",rtl:"@"},restrict:"AE",link:function(t,o,s){angular.element(o).css("display","none");var r,a,l,d,u,c;return a=function(){r=angular.extend(angular.copy(n),{enabled:"false"!==t.enabled,accessibility:"false"!==t.accessibility,adaptiveHeight:"true"===t.adaptiveHeight,autoplay:"true"===t.autoplay,autoplaySpeed:null!=t.autoplaySpeed?parseInt(t.autoplaySpeed,10):3e3,arrows:"false"!==t.arrows,asNavFor:t.asNavFor?t.asNavFor:void 0,appendArrows:angular.element(t.appendArrows?t.appendArrows:o),prevArrow:t.prevArrow?angular.element(t.prevArrow):void 0,nextArrow:t.nextArrow?angular.element(t.nextArrow):void 0,centerMode:"true"===t.centerMode,centerPadding:t.centerPadding||"50px",cssEase:t.cssEase||"ease",customPaging:s.customPaging?function(e,n){return t.customPaging({slick:e,index:n})}:void 0,dots:"true"===t.dots,draggable:"false"!==t.draggable,fade:"true"===t.fade,focusOnSelect:"true"===t.focusOnSelect,easing:t.easing||"linear",edgeFriction:t.edgeFriction||.15,infinite:"false"!==t.infinite,initialSlide:parseInt(t.initialSlide)||0,lazyLoad:t.lazyLoad||"ondemand",mobileFirst:"true"===t.mobileFirst,pauseOnHover:"false"!==t.pauseOnHover,pauseOnDotsHover:"true"===t.pauseOnDotsHover,respondTo:null!=t.respondTo?t.respondTo:"window",responsive:t.responsive||void 0,rows:null!=t.rows?parseInt(t.rows,10):1,slide:t.slide||"",slidesPerRow:null!=t.slidesPerRow?parseInt(t.slidesPerRow,10):1,slidesToShow:null!=t.slidesToShow?parseInt(t.slidesToShow,10):1,slidesToScroll:null!=t.slidesToScroll?parseInt(t.slidesToScroll,10):1,speed:null!=t.speed?parseInt(t.speed,10):300,swipe:"false"!==t.swipe,swipeToSlide:"true"===t.swipeToSlide,touchMove:"false"!==t.touchMove,touchThreshold:t.touchThreshold?parseInt(t.touchThreshold,10):5,useCSS:"false"!==t.useCSS,variableWidth:"true"===t.variableWidth,vertical:"true"===t.vertical,verticalSwiping:"true"===t.verticalSwiping,rtl:"true"===t.rtl},t.settings)},l=function(){var e=angular.element(o);return e.hasClass("slick-initialized")&&(e.remove("slick-list"),e.slick("unslick")),e},d=function(){a();var n=angular.element(o);if(angular.element(o).hasClass("slick-initialized")){if(r.enabled)return n.slick("getSlick");l()}else{if(angular.element(o).css("display","block"),!r.enabled)return;n.on("init",function(e,n){return"undefined"!=typeof r.event.init&&r.event.init(e,n),"undefined"!=typeof c?n.slideHandler(c):void 0}),e(function(){n.slick(r)})}t.internalControl=r.method||{},i.forEach(function(e){t.internalControl[e]=function(){var i;i=Array.prototype.slice.call(arguments),i.unshift(e),n.slick.apply(o,i)}}),n.on("afterChange",function(e,n,i,o){c=i,"undefined"!=typeof r.event.afterChange&&t.$apply(function(){r.event.afterChange(e,n,i,o)})}),n.on("beforeChange",function(e,n,i,o){"undefined"!=typeof r.event.beforeChange&&t.$apply(function(){r.event.beforeChange(e,n,i,o)})}),n.on("reInit",function(e,n){"undefined"!=typeof r.event.reInit&&t.$apply(function(){r.event.reInit(e,n)})}),"undefined"!=typeof r.event.breakpoint&&n.on("breakpoint",function(e,n,i){t.$apply(function(){r.event.breakpoint(e,n,i)})}),"undefined"!=typeof r.event.destroy&&n.on("destroy",function(e,n){t.$apply(function(){r.event.destroy(e,n)})}),"undefined"!=typeof r.event.edge&&n.on("edge",function(e,n,i){t.$apply(function(){r.event.edge(e,n,i)})}),"undefined"!=typeof r.event.setPosition&&n.on("setPosition",function(e,n){t.$apply(function(){r.event.setPosition(e,n)})}),"undefined"!=typeof r.event.swipe&&n.on("swipe",function(e,n,i){t.$apply(function(){r.event.swipe(e,n,i)})})},u=function(){l(),d()},o.one("$destroy",function(){l()}),t.$watch("settings",function(e,n){return null!==e?u():void 0},!0)}}}]); \ No newline at end of file diff --git a/package.json b/package.json index 737a320..5f13a30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-slick-carousel", - "version": "3.1.3", + "version": "3.1.4", "main": "dist/angular-slick.js", "repository": { "type": "git",