jquery - Prevent css transition depending on window size -
what common practice prevent css transitions when resizing window?
in example https://jsfiddle.net/f3c9e4n7/3/ different windows size, during "on" state, element animates position. can prevent animation adding class transition: none; timeout here: https://jsfiddle.net/f3c9e4n7/2/.
what better practice go this? adding timeout function seems not elegant solution.
$(".el").click(function() { if ( $(this).hasclass("off") ) { $(this).removeclass("off"); settimeout(function() { $(".el").addclass("notransition"); }, 650); } else { $(this).removeclass("notransition"); $(this).addclass("off"); } });
Comments
Post a Comment