I write these code and make it work in IE&chrome&firefox,It works well in chrome and firefox but wrong in IE. somebody tells me why,thanks!
these codes makes a animation when I push start button, I hope it stop when I push stop button,but when I push stop, the alert shows so much times.
ok,this is my code. becareful about your browser, maybe it will crash when the animation is playing.
forgive me about my poor english
<html style = "overflow:hidden">
<script src="jquery-1.7.2.js"></script>
<script>
var DIV ;
var CONTENT ;
var move = false;
$(function(){
DIV = $('<img src="7.png"></img>');
CONTENT = $('#content');
});
function startAnimation(){
$('#content').empty();
var div = $('<img src="7.png"></img>');
div.appendTo('#content');
var w_w=$(document).width();
var d_w=div.width();
var l=w_w/2 - d_w/2;
div.css("position","absolute");
div.css("top",$(document).height()+div.height());
div.css("left",l);
if(!move){
div.animate({top:-div.height(),left:l},1000,function(){
alert('ok');
return;
});
}else{
div.animate({top:-div.height(),left:l},1000,function(){
//setTimeout(function(){
startAnimation.call(window);
return;
});
}
}
function start(){
if(!move){
move = true;
startAnimation();
}
}
function stop(){
move = false;
}
</script>
<body style = "overflow:hidden">
<button onclick="start();">start</button>
<button onclick="stop();">stop</button>
<div id='content' sytle="width:1000px;height:700px;overflow:hidden">
</div>
</body>
</html>
Some Internet Explorer versions does ignore css values; without
pxat the end of it.top:200returns error buttop:200pxworks fine on ie.Try this: