2012-07-23 56 views
2

我想在我的web應用中使用jQuery fadIn函數,但持續時間/速度參數無論如何都沒有任何影響。下面是HTML代碼:jQuery淡入時間沒有影響

<!DOCTYPE html> 
<html> 
<head> 
    <title>Web App Test Bench</title> 
    <meta name="viewport" content="user-scalable=yes,width=device-width" /> 
    <meta charset="ISO-8859-1"/> 
    <link rel="icon" type="image/png" href="mj_logo.png" /> 
    <meta name="apple-mobile-web-app-capable" content="yes" /> 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0 /jquery.mobile-1.1.0.min.css" /> 


    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> 
    <script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script> 


<script type="text/javascript" src="test.js"></script> 
<body> 
    <section id="page1" data-role="page"> 

    <div data-role="content" class="content"> 

    <img id="logo" src="welcomeLogo.jpg" alt="Welcome Logo"/> 

    </div> 

</section> 

</body> 
</html> 

和JavaScript是:

$(document).ready(function() 
{ 
    $("#logo").hide().fadeIn("8000",function() 
    { 
     console.log("The animation is done"); 
    } 
    ).fadeOut("8000"); 


}) 

其價值,或大或小我選擇,動畫是在flash.Any建議做,以什麼事情不管是問題嗎?

回答

2

您需要通過速度爲整數,而不是一個字符串值,使你的代碼:

$(document).ready(function() 
{ 
    $("#logo").hide().fadeIn(8000,function() 
    { 
     console.log("The animation is done"); 
    } 
    ).fadeOut(8000); 
}) 

如果你想用一個字符串值,您可以使用「快」和'slow'分別指示200和600毫秒的持續時間。

+0

謝謝您節省我的一天 – user1107888 2012-07-23 15:03:34

2

它應該是一個數字而不是一個字符串。

$(document).ready(function() 
{ 
    $("#logo").hide().fadeIn("8000",function() 
    { 
     console.log("The animation is done"); 
    } 
    ).fadeOut(8000); 


})​ 
+0

謝謝您節省我的時間 – user1107888 2012-07-23 15:03:18