javascript - jQuery: switch between states & classes -
i got hidden-input display: none , opacity: 0. animation happens planned on label click.
however, need function toggle actually, can hide same animation if checkbox unchecked.
i thought commented code work if uncomment it, input never shown @ all.
how can modify js/css in way css opacity animation happens both on show & hide , toggles between hidden , visible states?
edit: having display: none in hidden state obligatory here.
see working version: http://jsfiddle.net/n4lep9jf/
there 2 changes:
1) making various css changes , setting class active before checking whether active. therefore, if statement in code return true, removing css changes. instead, class should set active (along accompanying lines of js) in else block of if statement.
2) set $toggler refer checkbox itself, , changed click handler change. found click event on label firing twice, , solves issue. surprised fact click handler firing twice, guess that's standard behavior labels linked checkboxes.
Comments
Post a Comment