/* document.write('
'); */ /*document.write('');*/ var delay = 10; var $obj,$obj2; $(function() { $obj = $("#imgDiv"); var time = window.setInterval("move($obj)", delay); $obj.mouseover(function() { clearInterval(time) }); $obj.mouseout(function() { time = window.setInterval("move($obj)", delay) }); /* $obj2 = $("#imgDiv2"); var time2 = window.setInterval("move2($obj2)", 14); $obj2.mouseover(function() { clearInterval(time2) }); $obj2.mouseout(function() { time2 = window.setInterval("move2($obj2)", 14) });*/ }); var xin = true, yin = true; var step = 0.6; var top1=180; function move($obj) { var tops = $(window).scrollTop(); var left = $obj.offset().left; var L = T = 0; //左边界和顶部边界 var R = $(window).width() - $obj.width(); // 右边界 var B = window.innerHeight - $obj.height(); //下边界 if (left < L) { xin = true; // 水平向右移动 } if (left > R) { xin = false; } if (top1 < T) { yin = true; } if (top1 > B) { yin = false; } left = left + step * (xin == true ? 1 : -1); top1 = top1 + step * (yin == true ? 1 : -1); $obj.offset({ top: top1+tops, left: left }) } var xin2 = true, yin2 = true; var top2=80; function move2($obj) { var tops = $(window).scrollTop(); var left = $obj.offset().left; var L = T = 0; //左边界和顶部边界 var R = $(window).width() - $obj.width(); // 右边界 var B = window.innerHeight - $obj.height(); //下边界 if (left < L) { xin2 = true; // 水平向右移动 } if (left > R) { xin2 = false; } if (top2 < T) { yin2 = true; } if (top2 > B) { yin2 = false; } left = left + step * (xin2 == true ? 1 : -1); top2 = top2 + step * (yin2 == true ? 1 : -1); $obj.offset({ top: top2+tops, left: left }) } $(function() { $(".a").click(function() { var b = $(this).parent(); $(b).remove(); }) })