2011-02-01 39 views

回答

1

$是jQuery主要功能的名稱。您在jQuery之前包含您的燈箱腳本; jQuery必須先來。

0

在你的頭上的標籤,你需要做的是在這個順序:

<head> 

// other stuff 

<script type="text/javascript" src="/res/javascript/jquery.js"></script> 
<script type="text/javascript" src="/res/javascript/jquery.lightbox-0.5.js"></script> 
<script type="text/javascript"> 
$(document).ready(function() { 
    $('.storycontent a.lightbox').lightBox(); 
}); 
</script> 

// other stuff 

</head> 

使用$(文件)。就緒(),而不是隻調用該函數,它等待這樣,直到整個DOM是在運行lightBox方法之前準備就緒,並且不必一直放在頁面的底部。

當我剛纔嘗試這個時,它工作得很好。