Skip to content
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
15 changes: 15 additions & 0 deletions priv/www/nitrogen.css
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,18 @@ a.upload_delete_file:hover {
left:-10000px;
}

.n2-effect-appear {
transition: height 500ms, opacity 500ms;
height: auto;
opacity: inherit;
}

.n2-effect-fade {
transition: height 500ms, opacity 500ms;
height: 0;
opacity: 0;
}

.n2-effect-hidden {
display: none;
}
19 changes: 12 additions & 7 deletions src/actions/action_jquery_effect.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ render_action(Record) ->

Script = case Record#jquery_effect.type of
'show' when Effect==none ->
if_visible(Actions, ["$(this).show(", ActionsFun, ");"]);
{raw, ["this.forEach(node => { node.classList.remove('n2-effect-hidden'); } )"]};
'hide' when Effect==none ->
if_visible(["$(this).hide(", ActionsFun, ");"], Actions);
{raw, ["this.forEach(node => { node.classList.remove('n2-effect', 'n2-effect-fase', 'n2-effect-appear'); node.classList.add('n2-effect-hidden'); } )"]};
'toggle' when Effect==none ->
["toggle(", ActionsFun, ");"];
{raw, ["this.forEach(node => { node.classList.remove('n2-effect', 'n2-effect-fase', 'n2-effect-appear'); node.classList.toggle('n2-effect-hidden'); } )"]};
'appear' ->
if_visible(Actions, [wf:f("$(this).fadeIn(~p, ", [Speed]), ActionsFun, ");"]);
{raw, ["this.forEach(node => { node.classList.remove('n2-effect-fade'); node.classList.add('n2-effect', 'n2-effect-appear'); } )"]};
'fade' ->
if_visible([wf:f("$(this).fadeOut(~p, ", [Speed]), ActionsFun, ");"], Actions);
'slideup'->
{raw, ["this..forEach(node => { node.classList.remove('n2-effect-appear'); node.classList.add('n2-effect', 'n2-effect-fade'); } )"]};
'slideup' ->
if_visible([wf:f("$(this).slideUp(~p, ",[Speed]), ActionsFun, ");"], Actions);
'slidedown' ->
if_visible(Actions, [wf:f("$(this).slideDown(~p, ",[Speed]), ActionsFun, ");"]);
Expand All @@ -65,7 +65,12 @@ render_action(Record) ->
'animate' ->
[wf:f("animate(~s, ~p, '~s', ", [Options, Speed, Easing]), ActionsFun, ");"]
end,
[wf:f("objs('~s').", [Target]), Script].
R = case Script of
{raw, S} -> [";(function(){", S, "}.bind(", wf:f("document.querySelectorAll('~s')", [Target]), ")})();"];
S -> [wf:f("objs('~s').", [Target]), Script]
end,
io:format("Effect: ~p~n", [R]),
R.

execute_actions_fun("null") ->
"";
Expand Down