2014-05-07 88 views
-1

所以我創建了一個名爲1的類,當我使用下面的jQuery代碼調用它時;類呼叫不起作用

<script> 
    $(document).ready(function() { 
     $(".1").hide().fadeIn(3000); 
    }); 
</script> 

淡入效果不起作用。

這裏是所有必要的代碼;

<!DOCTYPE html> 
<html> 
<head> 
<style> 
body { 
     background: url(bg.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 
span.1{ 
    color: #fff; 
    margin-left: auto; 
    margin-right: auto; 
    width: 8em; 
    margin-top: 6em; 
    font-size: 40px; 
} 
</style> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 
<script> 
$(document).ready(function(){$(".1").hide().fadeIn(3000);}); 
</script> 
</head> 
<body> 
<span class="1">Testing the Fade!</span> 
</body> 
</html> 
+7

類名不能以數字開頭。 http://stackoverflow.com/a/449000/597419 – Danny

+0

正如@Danny所說的,只要將你的類名從'1'改爲'one',它就可以工作。 –

+1

http://jsfiddle.net/isherwood/sJm8E/ – isherwood

回答

相關問題