Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #14 #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions demo/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,23 @@
if (openPromise) {
$timeout.cancel(openPromise);
}
element.css({
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: timingFunction,
height: getHeight()
});
return openPromise = $timeout(function () {
return element.css({
overflow: 'visible',
transition: 'none',
height: 'auto'
element.css({ height: getHeight() });
return $timeout(function () {
element.css({
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: timingFunction
});
}, duration * 1000);
});
return openPromise = $timeout(function () {
return element.css({
overflow: 'visible',
transition: 'none',
height: 'auto'
});
}, duration * 1000, false);
}, 0, false);
}, 0, false);
};
hide = function () {
if (openPromise) {
Expand Down Expand Up @@ -91,7 +93,7 @@
element.css({ height: getHeight() });
element[0].clientHeight;
}
return $timeout(hide);
return $timeout(hide, 0, false);
}
});
};
Expand Down
32 changes: 17 additions & 15 deletions dist/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,23 @@
if (openPromise) {
$timeout.cancel(openPromise);
}
element.css({
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: timingFunction,
height: getHeight()
});
return openPromise = $timeout(function () {
return element.css({
overflow: 'visible',
transition: 'none',
height: 'auto'
element.css({ height: getHeight() });
return $timeout(function () {
element.css({
overflow: 'hidden',
transitionProperty: 'height',
transitionDuration: '' + duration + 's',
transitionTimingFunction: timingFunction
});
}, duration * 1000);
});
return openPromise = $timeout(function () {
return element.css({
overflow: 'visible',
transition: 'none',
height: 'auto'
});
}, duration * 1000, false);
}, 0, false);
}, 0, false);
};
hide = function () {
if (openPromise) {
Expand Down Expand Up @@ -91,7 +93,7 @@
element.css({ height: getHeight() });
element[0].clientHeight;
}
return $timeout(hide);
return $timeout(hide, 0, false);
}
});
};
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.

27 changes: 17 additions & 10 deletions src/ng-slide-down.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,26 @@ angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->
$timeout ->
$timeout.cancel(openPromise) if openPromise
element.css {
overflow: "hidden"
transitionProperty: "height"
transitionDuration: "#{duration}s"
transitionTimingFunction: timingFunction
height: getHeight()
}
openPromise = $timeout ()->

$timeout ->
element.css {
overflow: "visible"
transition: "none",
height: "auto"
overflow: "hidden"
transitionProperty: "height"
transitionDuration: "#{duration}s"
transitionTimingFunction: timingFunction
}
, duration*1000

openPromise = $timeout ()->
element.css {
overflow: "visible"
transition: "none",
height: "auto"
}
, duration*1000, false
, 0, false
,0, false


hide = ()->
Expand Down Expand Up @@ -69,7 +76,7 @@ angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->
height: getHeight()
}
element[0].clientHeight # Force reflow so the animation triggers reliably
$timeout hide
$timeout hide, 0, false

return {
restrict: 'A'
Expand Down