In the previous article: I felt that the text in the lower-left corner of pig 8 had a good effect. I tried it myself and implemented it in my own way!
This is the case, but it has little impact. The Demo has a big impact!
Some people have encountered such problems on the Internet. refer to the following post address:
SetInterval in firefox 6
There are many people to discuss, but no answer is provided.
I don't even understand what I think!
Today, suddenly, it may be the concept of a thread, but the specific reason is still not clear. I hope someone can understand what it was supposed to say. Thank you very much!
The black Div in the Demo is not affected by browser tag switching.
The red Div will be affected.
HTML:
Copy codeThe Code is as follows:
<Div id = "move" style = "position: absolute; width: 100px; height: 100px; top: 0pt; left: 0pt; background: none repeat scroll 0% 0% #000000; z-index: 999; color: # ffffff; "> I am not affected by browser tag switching! Hoooo </div>
<Div id = "move2" style = "position: absolute; width: 100px; height: 100px; top: 0pt; left: 0pt; background: none repeat scroll 0% 0% red; z-index: 999; color: # ffffff; "> I'm affected by browser tag switching! 5555 </div>
Javascript:
Copy codeThe Code is as follows:
(Function (){
Var elem = Meng. getId ('move '),
Elem2 = Meng. getId ('move2 '),
Pos = Meng. getElemViewPosition (elem ),
View = Meng. getBrowserView (),
// Gray block motion function
Move = function (){
Var t1 = Meng. animate (elem, {top: 0, left: 0}, {top: view. height-100, left: view. width-100}, 3000, function (){
Var t2 = Meng. animate (elem, {left: view. width-100}, {left: 100-view.width}, 3000, function (){
Var t3 = Meng. animate (elem, {top: view. height-100}, {top: 100-view.height}, 3000, function (){
Move (); // after determining the t3 motion, I will call back the move () function.
});
});
});
};
Move ();
// Red block motion function
Meng. setStyle (elem2, {top: 0, left :( view. width-100) + 'px '});
Var move2 = function (){
Var t1 = Meng. animate (elem2, {top: 0, left: view. width-100}, {top: view. height-100, left: 100-view.width}, 3000, function (){
Var t2 = Meng. animate (elem2, {top: view. height-100}, {top: 100-view.height}, 3000, function (){
Var t3 = Meng. animate (elem2, {left: 0}, {left: view. width-100}, 3000, function (){
});
});
});
};
Move2 ();
SetInterval (function () {move2 () ;}, 9050 );
// Red block motion function
})();