From 8382a2c93fdbf3c3d27c57a83eefef6422da3640 Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Tue, 4 Feb 2014 17:39:53 +0100 Subject: [PATCH] Released 0.2.6. --- angular-scroll.js | 7 ++++--- angular-scroll.min.js | 2 +- angular-scroll.min.js.map | 2 +- bower.json | 2 +- package.json | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/angular-scroll.js b/angular-scroll.js index b08c81c..9c2f3ce 100644 --- a/angular-scroll.js +++ b/angular-scroll.js @@ -1,4 +1,4 @@ -angular.module('duScroll', ['duScroll.scroller', 'duScroll.scrollPosition', 'duScroll.scrollspy', 'duScroll.requestAnimation', 'duScroll.smoothScroll']); +angular.module('duScroll', ['duScroll.scroller', 'duScroll.scrollPosition', 'duScroll.scrollspy', 'duScroll.requestAnimation', 'duScroll.smoothScroll']).value('duScrollDuration', 1000); angular.module('duScroll.requestAnimation', []). @@ -123,7 +123,7 @@ factory('scroller', angular.module('duScroll.smoothScroll', ['duScroll.scroller']). -directive('duSmoothScroll', function(scroller){ +directive('duSmoothScroll', function(scroller, duScrollDuration){ return { link : function($scope, $element, $attr){ @@ -137,9 +137,10 @@ directive('duSmoothScroll', function(scroller){ if (e.preventDefault) e.preventDefault(); var offset = -($attr.offset ? parseInt($attr.offset, 10) : 0); + var duration = $attr.duration ? parseInt($attr.duration, 10) : duScrollDuration; var pos = elem.getBoundingClientRect(); - scroller.scrollDelta(0, pos.top + (isNaN(offset) ? 0 : offset), 1000); + scroller.scrollDelta(0, pos.top + (isNaN(offset) ? 0 : offset), duration); }); } }; diff --git a/angular-scroll.min.js b/angular-scroll.min.js index 344165d..e95d10e 100644 --- a/angular-scroll.min.js +++ b/angular-scroll.min.js @@ -1,2 +1,2 @@ -angular.module("duScroll",["duScroll.scroller","duScroll.scrollPosition","duScroll.scrollspy","duScroll.requestAnimation","duScroll.smoothScroll"]),angular.module("duScroll.requestAnimation",[]).factory("requestAnimation",["$window","$timeout",function(a,b){return a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(a){b(a,1e3/60)}}]),angular.module("duScroll.scrollPosition",["duScroll.requestAnimation"]).factory("scrollPosition",["$document","$window","$rootScope","requestAnimation",function(a,b,c,d){var e=[],f=0,g=0,h=function(){c.$emit("$duScrollChanged",g),g=f;for(var a=0;aj&&b(l)};l()}}function f(a,b,d){e(c.x()+(a||0),c.y()+(b||0),d)}function g(a,b,c){if(angular.isElement(a)&&(a=a[0]||a,a.getBoundingClientRect)){var d=a.getBoundingClientRect();f(0,d.top+(!b||isNaN(b)?0:-b),c)}}return{scrollTo:e,scrollToElement:g,scrollDelta:f}}]),angular.module("duScroll.smoothScroll",["duScroll.scroller"]).directive("duSmoothScroll",["scroller",function(a){return{link:function(b,c,d){var e=angular.element(c[0]);e.on("click",function(b){if(d.href&&-1!==d.href.indexOf("#")){var c=document.getElementById(d.href.replace(/.*(?=#[^\s]+$)/,"").substring(1));if(c&&c.getBoundingClientRect){b.stopPropagation&&b.stopPropagation(),b.preventDefault&&b.preventDefault();var e=-(d.offset?parseInt(d.offset,10):0),f=c.getBoundingClientRect();a.scrollDelta(0,f.top+(isNaN(e)?0:e),1e3)}}})}}}]),angular.module("duScroll.scrollspy",["duScroll.scrollPosition"]).directive("duScrollspy",["$rootScope","scrollPosition",function(a){function b(){for(var a,b,c,d=0;dj&&b(l)};l()}}function f(a,b,d){e(c.x()+(a||0),c.y()+(b||0),d)}function g(a,b,c){if(angular.isElement(a)&&(a=a[0]||a,a.getBoundingClientRect)){var d=a.getBoundingClientRect();f(0,d.top+(!b||isNaN(b)?0:-b),c)}}return{scrollTo:e,scrollToElement:g,scrollDelta:f}}]),angular.module("duScroll.smoothScroll",["duScroll.scroller"]).directive("duSmoothScroll",["scroller","duScrollDuration",function(a,b){return{link:function(c,d,e){var f=angular.element(d[0]);f.on("click",function(c){if(e.href&&-1!==e.href.indexOf("#")){var d=document.getElementById(e.href.replace(/.*(?=#[^\s]+$)/,"").substring(1));if(d&&d.getBoundingClientRect){c.stopPropagation&&c.stopPropagation(),c.preventDefault&&c.preventDefault();var f=-(e.offset?parseInt(e.offset,10):0),g=e.duration?parseInt(e.duration,10):b,h=d.getBoundingClientRect();a.scrollDelta(0,h.top+(isNaN(f)?0:f),g)}}})}}}]),angular.module("duScroll.scrollspy",["duScroll.scrollPosition"]).directive("duScrollspy",["$rootScope","scrollPosition",function(a){function b(){for(var a,b,c,d=0;d