i'm trying out jqueryrotate, , want make img
rotate 90-degrees on clicking, rotate original position on next click. i've looked relentlessly through different google searches, etc., haven't found answer i'm wanting.
here's code:
<script type="text/javascript"> $(document).ready(function() { $("#menu_icon").rotate({bind:{click: function(){ $(this).rotate({ duration:100, angle:0,animateto:90,easing: $.easing.easeinoutexpo }, 10)} } }); }); </script>
how adjust create desired result? , don't want flash , go 90-degrees, want move animation first time clicking.
$("#menu_icon").rotate({ bind:{ click: function(){ var $this = $(this); if($this.data('rotate')){ $this.data('rotate', false); $this.rotate({ duration:100, angle:0,animateto:"-=90",easing: $.easing.easeinoutexpo }, 10) }else{ $this.data('rotate', true); $this.rotate({ duration:100, angle:0,animateto:90,easing: $.easing.easeinoutexpo }, 10) } } } });
we add data parameter holds true/false, check conditional, , respond accordingly.
to go 90 degrees last rotation, employ -=90
animateto
parameter.
Comments
Post a Comment