Skip to content

Commit

Permalink
Merge pull request #4 from maximilianschmitt/timing-function-attribute
Browse files Browse the repository at this point in the history
add timing function-attribute
  • Loading branch information
TheRusskiy committed Apr 29, 2015
2 parents 54e380e + 30f6d7a commit 79623e6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Main attribute, required for directive to work, passed variable defines whether
Time in seconds for animation to complete (default is 1 second).

<code>&lt;div ng-slide-down=&quot;slideDown&quot; duration=&quot;1.5&quot;&gt;</code>

#### timing-function
Easing function (`transition-timing-function`) to use in the animation (default is ease-in-out).

<code>&lt;div ng-slide-down=&quot;slideDown&quot; timing-function=&quot;linear&quot;&gt;</code>
#### lazy-render
Add this attribute to prevent rendering when content is hidden. Doesn't require value.

Expand Down
7 changes: 4 additions & 3 deletions demo/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
}
};
link = function (scope, element, attrs, ctrl, transclude) {
var closePromise, duration, elementScope, emitOnClose, getHeight, hide, lazyRender, onClose, openPromise, show;
var closePromise, duration, elementScope, emitOnClose, getHeight, hide, lazyRender, onClose, openPromise, show, timingFunction;
duration = attrs.duration || 1;
timingFunction = attrs.timingFunction || 'ease-in-out';
elementScope = element.scope();
emitOnClose = attrs.emitOnClose;
onClose = attrs.onClose;
Expand Down Expand Up @@ -45,7 +46,7 @@
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: 'ease-in-out',
transitionTimingFunction: timingFunction,
height: getHeight()
});
return openPromise = $timeout(function () {
Expand All @@ -65,7 +66,7 @@
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: 'ease-in-out',
transitionTimingFunction: timingFunction,
height: '0px'
});
if (emitOnClose || onClose || lazyRender) {
Expand Down
7 changes: 4 additions & 3 deletions dist/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
}
};
link = function (scope, element, attrs, ctrl, transclude) {
var closePromise, duration, elementScope, emitOnClose, getHeight, hide, lazyRender, onClose, openPromise, show;
var closePromise, duration, elementScope, emitOnClose, getHeight, hide, lazyRender, onClose, openPromise, show, timingFunction;
duration = attrs.duration || 1;
timingFunction = attrs.timingFunction || 'ease-in-out';
elementScope = element.scope();
emitOnClose = attrs.emitOnClose;
onClose = attrs.onClose;
Expand Down Expand Up @@ -45,7 +46,7 @@
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: 'ease-in-out',
transitionTimingFunction: timingFunction,
height: getHeight()
});
return openPromise = $timeout(function () {
Expand All @@ -65,7 +66,7 @@
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: 'ease-in-out',
transitionTimingFunction: timingFunction,
height: '0px'
});
if (emitOnClose || onClose || lazyRender) {
Expand Down
4 changes: 2 additions & 2 deletions dist/ng-slide-down.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/ng-slide-down.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->

link = (scope, element, attrs, ctrl, transclude) ->
duration = attrs.duration || 1
timingFunction = attrs.timingFunction || "ease-in-out"
elementScope = element.scope()
emitOnClose = attrs.emitOnClose
onClose = attrs.onClose
Expand All @@ -31,7 +32,7 @@ angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->
overflow: "hidden"
transitionProperty: "height"
transitionDuration: "#{duration}s"
transitionTimingFunction: "ease-in-out"
transitionTimingFunction: timingFunction
height: getHeight()
}
openPromise = $timeout ()->
Expand All @@ -49,7 +50,7 @@ angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->
overflow: "hidden"
transitionProperty: "height"
transitionDuration: "#{duration}s"
transitionTimingFunction: "ease-in-out"
transitionTimingFunction: timingFunction
height: '0px'
}
if emitOnClose || onClose || lazyRender
Expand Down

0 comments on commit 79623e6

Please sign in to comment.