Skip to content

Commit

Permalink
Don't trigger hide animation on load + force reflow to avoid chrome b…
Browse files Browse the repository at this point in the history
…ug. Thanks to Sebastian Pettersson
  • Loading branch information
TheRusskiy committed Dec 21, 2014
1 parent 0899029 commit fd71f1d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-slide-down",
"version": "0.2.0",
"version": "0.3.0",
"authors": [
"TheRusskiy <[email protected]>"
],
Expand Down
5 changes: 4 additions & 1 deletion demo/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@
if (value) {
return $timeout(show);
} else {
element.css({ height: getHeight() });
if (value != null) {
element.css({ height: getHeight() });
element[0].clientHeight;
}
return $timeout(hide);
}
});
Expand Down
5 changes: 4 additions & 1 deletion dist/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@
if (value) {
return $timeout(show);
} else {
element.css({ height: getHeight() });
if (value != null) {
element.css({ height: getHeight() });
element[0].clientHeight;
}
return $timeout(hide);
}
});
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.

8 changes: 5 additions & 3 deletions src/ng-slide-down.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->
if value
$timeout show
else
element.css {
height: getHeight()
}
if value?
element.css {
height: getHeight()
}
element[0].clientHeight # Force reflow so the animation triggers reliably
$timeout hide

return {
Expand Down

0 comments on commit fd71f1d

Please sign in to comment.