2011-07-22 83 views
1

當前我在使用jquery-ui和動畫函數時遇到了一些問題,我不知道我是否錯誤地使用了它或者什麼,但是我無法獲得stop()正常工作。jquery-ui和動畫bug

例如,當鼠標懸停在一個div上,它會動畫一些東西,然後鼠標懸停它會動畫別的東西,但是當鼠標懸停和快速出來時,它會有問題..任何人都可以幫我解決這個問題嗎?

,這裏是完整的HTML + JS:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>jtest</title> 
<link rel="Shortcut Icon" href="favicon.ico" /> 
<meta name="keywords" content="" /> 
<meta name="description" content="" /> 
<link href="css/style.css" rel="stylesheet" type="text/css" /> 
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/> 
<script src="js/jquery.min.js"></script> 
<script src="js/jquery-ui.min.js"></script> 
<script> 
function showbox2() { 
    $('#box2').show().animate({ 
     opacity: 1, 
     top: '+=1025' 
     }, 1200, 'easeOutExpo'); 
} 
function runbox2() { 
    $(".box2_img").show("fade", 800); 
    $('.box2').cycle({ 
     fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
     timeout: 3500 
    }); 
} 
function xbox2() { 
    $(".box2x").stop().show("blind", { direction: "horizontal" }, 500); 
    $(".box3").stop().hide("blind", { direction: "horizontal" }, 800); 
} 
function hbox2() { 
    $(".box2x").stop().hide("blind", { direction: "horizontal" }, 500); 
    $(".box3").stop().show("blind", { direction: "horizontal" }, 800); 
} 
function showbox3() { 
    $('#box3').show().animate({ 
     opacity: 1, 
     right: '-=1000' 
     }, 1200, 'easeOutExpo'); 
} 
function runbox3() { 
    $(".box3_img").show("fade", 800); 
    $('.box3').cycle({ 
     fx: 'scrollRight', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
     timeout: 4500 
    }); 
} 
function xbox3() { 
    $(".box3x").stop().show("blind", { direction: "horizontal" }, 500); 
    $(".box2").stop().hide("fade", 800); 
} 
function hbox3() { 
    $(".box3x").stop().hide("blind", { direction: "horizontal" }, 500); 
    $(".box2").stop().show("fade", 800); 
} 
function showbox9() { 
    $('#box9').show().animate({ 
     opacity: 1, 
     right: '+=1241' 
     }, 1200, 'easeOutExpo'); 
} 
function runbox9() { 
    $(".box9_img").show("fade", 800); 
    $('.box9').cycle({ 
     fx: 'scrollRight', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
     timeout: 4800 
    }); 
} 
function showbox10() { 
    $('#box10').show().animate({ 
     opacity: 1, 
     right: '-=1000' 
     }, 1200, 'easeOutExpo'); 
} 
function runbox10() { 
    $(".box10_img").show("fade", 800); 
    $('.box10').cycle({ 
     fx: 'turnUp', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
     timeout: 3800 
    }); 
} 
function showbox11() { 
    $('#box11').show().animate({ 
     opacity: 1, 
     bottom: '-=1000' 
     }, 1200, 'easeOutExpo'); 
} 
function runbox11() { 
    $(".box11_img").show("fade", 800); 
    $('.box11').cycle({ 
     fx: 'zoom', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
     timeout: 7700 
    }); 
} 
function xbox11() { 
    $(".box11x").stop().show("blind", { direction: "vertical" }, 500); 
    $(".box9").stop().hide("explode", { direction: "vertical" }, 1000); 
    $(".box10").stop().hide("explode", { direction: "vertical" }, 1000); 
} 
function hbox11() { 
    $(".box11x").stop().hide("explode", { direction: "vertical" }, 1000); 
    $(".box9").stop().show("blind", { direction: "vertical" }, 500); 
    $(".box10").stop().show("blind", { direction: "vertical" }, 500); 
} 
function showit() { 
    document.getElementById('loading_msg').style.display=('none'); 
    setTimeout("showbox2()",500); 
    setTimeout("showbox3()",800); 
    setTimeout("showbox9()",1300); 
    setTimeout("showbox10()",1500); 
    setTimeout("showbox11()",1800); 

    setTimeout("runbox2()",1200); 
    setTimeout("runbox3()",1800); 
    setTimeout("runbox9()",2500); 
    setTimeout("runbox10()",2800); 
    setTimeout("runbox11()",2800); 

} 
</script> 
<script type="text/javascript" src="js/jquery.cycle.all.js"></script> 
</head> 

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="showit();"> 
<div id="outer-container"> 
    <div id="loading_msg">Loading, please wait ...</div> 

    <div id="container"> 
     <div id="box2" class="box2" onmouseover="xbox2();"> 
      <div class="box2_img" style="background-color:#F00; width:199px; height:233px;"></div> 
      <div class="box2_img" style="background-color:#0F0; width:199px; height:233px;"></div> 
     </div> 
     <div id="box2x" class="box2x" onmouseout="hbox2();"> 
      <div class="box2_imgx" style="display:block; background-color:#FFF;"></div> 
     </div> 
     <div id="box3" class="box3" onmouseover="xbox3();"> 
      <div class="box3_img" style="background-color:#F00; width:196px; height:233px;"></div> 
      <div class="box3_img" style="background-color:#0F0; width:196px; height:233px;"></div> 
     </div> 
     <div id="box3x" class="box3x" onmouseout="hbox3();"> 
      <div class="box3_imgx" style="display:block; background-color:#FFF;"></div> 
     </div> 
     <div id="box9" class="box9"> 
      <div class="box9_img" style="background-color:#F00; width:199px; height:118px;"></div> 
      <div class="box9_img" style="background-color:#0F0; width:199px; height:118px;"></div> 
     </div> 
     <div id="box10" class="box10"> 
      <div class="box10_img" style="background-color:#F00; width:196px; height:118px;"></div> 
      <div class="box10_img" style="background-color:#0F0; width:196px; height:118px;"></div> 
     </div> 
     <div id="box11" class="box11" onmouseover="xbox11();"> 
      <div class="box11_img" style="background-color:#fff; width:405px; height:203px;"></div> 
     </div> 
     <div id="box11x" class="box11x" onmouseout="hbox11();"> 
      <div class="box11_imgx" style="display:block; background-color:#FFF;"></div> 
     </div> 
    </div> 
</div> 
</body> 
</html> 

謝謝! =)

+1

.mouseenter().mouseleave()http://api.jquery.com/mouseleave/ –

+0

謝謝,一個有用的功能是新的給我,但我仍然無法得到它的工作,(還嘗試了): jihchuan

+0

好吧,它現在的工作,但問題仍然存在,這是當鼠標輸入/離開太快,然後頁面崩潰~~ – jihchuan

回答

0

你可以做一個更簡單的例子或描述確切應該發生什麼和發生了什麼請,我會修復。我曾經看到過,在發生垃圾郵件事件的地方,某些變量沒有正確重置,但直到我看到縮短的代碼很難找出你真正想要發生的事情。

感謝

+0

這是答案? –

+0

@JatinDhoot他不能評論發佈,由於低信譽,你甚至更低 –

+0

行eicto ---------不知道------------我試圖upvote,但我的投票暫時被鎖定。但「傻瓜」仍然不易消化:) –