Saturday, 15 June 2013

javascript - Change rotate direction of div after every 5 second -


I have two div (i.e div1 and div2), div1 anticlockwise direction and rotate the other div2 in the clockwise direction. Now I want both divs to rotate their rotation direction after every 5 seconds, such that the div1 will rotate clockwise after 5 seconds, after rotating the anticonvic, in the clockwise direction of 5 seconds and then continuously. This process is implemented in any other device.

  & lt; Div id = "div1" style = "height: 100px; width: 100px; border: 2px solid brown" & gt; Div1 & lt; / Div & gt; & Lt; Div id = "div2" style = "margin-top: 100px; height: 100px; width: 100px; range: 2px solid red" & gt; Div2 & lt; / Div & gt; & Lt; Script & gt; Rotate (0,0); Rotate the function (degree 1, degree2) {$ ("# div1") CSS ({WebkitTransform: 'rotate (' + degree 1 + 'degree)'}); $ ("# Div2") CSS ({WebKit Transform: 'Rotate (' + 2 + 'degree +' degree '}); $ ("# Div1") CSS ({'-moz-transform': 'rotate (' + degree 1 + 'degree)'}); $ ("# Div2") CSS ({'-moz-transform': 'rotate (' + 2 + 'degree +' degree ')); Timer = settimeout (function () {roll (++ degree 1, - degrees 2);}, 5); } & Lt; / Script & gt;  

If I understand your problem correctly, (And here's A):

  var invert = false; StartRotating (); Function startup () {to rotate (0, 0); SetTimeout (Invertrotet, 5000); } Invertrait () {invert =! Invert; SetTimeout (Invertrotet, 5000); } Rotate the function (degree 1, degree2) {$ ("# div1"). CSS ({WebKit Transform: 'Rotate (' + 1 + 'degree' degree ')}); $ ("# Div2") CSS ({WebKit Transform: 'Rotate (' + 2 + 'degree +' degree '}); $ ("# Div1") CSS ({'-moz-transform': 'rotate (' + degree 1 + 'degree)'}); $ ("# Div2") CSS ({'-moz-transform': 'rotate (' + 2 + 'degree +' degree ')); SetTimeout (to rotate the function () (inverted) (++ degree 1, - degrees 2): to rotate (- degree 1, ++ degree 2);}, 5);}    

No comments:

Post a Comment