/* 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(); }) })