Can anyone explain this jQuery code?

This code is taken from http://wilq32.googlepages.com/wilq32.rollimage222 and is supposed to animate the rotation of the image.

I can’t define the structure exactly and how to train it to do what I want, for example, to make div X rotate div Y on hover (instead of rotation) or add other functions like fade to animation.

$(document).ready(function()
  {
   var rot=$('#image3').rotate({maxAngle:25,minAngle:-55,
    bind:
     [
     {"mouseover":function(){rot[0].rotateAnimation(85);}},
     {"mouseout":function(){rot[0].rotateAnimation(-35);}}
     ]
   });
  });

Thanks in advance

+1
source share
3 answers

. 1) $(document).ready() 2) "rot" jQuery.rotate. 3) , . , .

"rotateAnimation (85)", -35. , , .

, .

$(document).ready(function()
    {
            var rot=$('#image3').rotate({maxAngle:25,minAngle:-55,
            bind:
                    [
                            {"mouseover":function(){
                                 rot[0].rotateAnimation(85);}
                                 //insert awesome fades and effects here.
                            },
                            {"mouseout":function(){
                                 rot[0].rotateAnimation(-35);}
                                 // insert more cool fades and effects here.
                            }
                    ]
            });
    });

, .

+4

bind rotateimage. , rotate, .

$(document).ready(function()
{
     $('#divY').mouseover( $('#divX').rotate({angle:35}) );
     $('#divY').mouseout( $('#divX').rotate({angle:-85}) ); 
});
+1

var rot '#image3'. 55 25 . . # image3 rotateAnimation.

The bind section then takes the contents of the array, which contains two objects to bind. The first binds mouseoverto # image3 so that it causes a call to rotate rot[0], which in itself, is 85 degrees clockwise. This does not move 85 degrees, but is limited by the previous setting to only 25 degrees.

The second does a similar thing with a snap mouseout, so that it will move 35 degrees counterclockwise, and this movement is not limited minAngle.

0
source

Source: https://habr.com/ru/post/1725749/


All Articles