Skip to content

Commit

Permalink
Added toggle variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
vzaccaria committed May 25, 2014
1 parent 6f95b5c commit 83e06bd
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions assets/js/entry.ls
Expand Up @@ -106,5 +106,26 @@ _q.all(p-array).then ->
entry-debug-message "Initializing handler"
scroll-handler()



window.dynCss.api.initVariable = (vr, value) ->
window.dynCss.lib[vr] = value

window.dynCss.api.setVariable = (vr, value) ->
window.dynCss.api.initVariable vr, value
scroll-handler()

window.dynCss.api.initToggle = (vr, value1, value2) ->
window.dynCss.api.initVariable vr, value1
window.dynCss.api.initVariable vr+"Value0", value1
window.dynCss.api.initVariable vr+"Value1", value2
entry-debug-message "Initialising variable #vr to #value1"

window.dynCss.api.toggle = (vr) ->
vv = window.dynCss.lib[vr]
v1 = window.dynCss.lib[vr+"Value0"]
v2 = window.dynCss.lib[vr+"Value1"]
if vv == v1
window.dynCss.api.setVariable vr, v2
entry-debug-message "Setting #vr to #v2"
else
window.dynCss.api.setVariable vr, v1
entry-debug-message "Setting #vr to #v1"

0 comments on commit 83e06bd

Please sign in to comment.