开发者

Move 4 iframes/elements at the same time?

I'm trying to move 4 iframes simultaneously, however I have a problem when they get out of the screen. You can see the m开发者_开发知识库isbehavior here: (I used a small div to make it easier to see the problem)

http://chusmix.com/test2.php

Basically they get on top of each other instead of staying in the same positions.

And this is the code that moves the iframes:

// Move iframes
setInterval(function() {
 if(left==true && right!=true){
        $(".site").animate({'left':'+=10'}, 0);
     }
 if(right==true && left!=true){
        $(".site").animate({'left':'-=10'}, 0);
     }
 if(up==true && down!=true){
        $(".site").animate({'top':'+=10'}, 0);
     }
 if(down==true && up!=true){
        $(".site").animate({'top':'-=10'}, 0);
     }
}, 20);

What is wrong with my code?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜