mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 11:01:56 +02:00
Add directive based on jQuery animation API.
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user