mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add directive based on jQuery animation API.
This commit is contained in:
parent
71cfc863b5
commit
cd2c8e7199
1 changed files with 15 additions and 0 deletions
|
@ -0,0 +1,15 @@
|
||||||
|
define [
|
||||||
|
"base"
|
||||||
|
], (App) ->
|
||||||
|
App.directive "reviewPanelCollapseHeight", ($parse) ->
|
||||||
|
return {
|
||||||
|
restrict: "A",
|
||||||
|
link: (scope, element, attrs) ->
|
||||||
|
scope.$watch (() -> $parse(attrs.reviewPanelCollapseHeight)(scope)), (shouldCollapse) ->
|
||||||
|
neededHeight = element.prop("scrollHeight")
|
||||||
|
if neededHeight > 0
|
||||||
|
if shouldCollapse
|
||||||
|
element.animate { height: 0 }, 150
|
||||||
|
else
|
||||||
|
element.animate { height: neededHeight }, 150
|
||||||
|
}
|
Loading…
Reference in a new issue