2013-07-18 144 views
0

我對JQuery(以及一般的HTML)非常陌生,我試圖獲得一個覆蓋圖來顯示和播放嵌入式電影,當圖像被點擊時。但是,圖像不可點擊,我看不出爲什麼。JQuery覆蓋不會工作

這裏是我的代碼:

<style> 
    .film_overlay { 
    display:none; 
    z-index:500; 
    background-color:#d0d0d0; 
    width:520; 
    min-heigth:300; 
    border:1px solid #666; 
    -moz-box-shadow:0 0 90px 5px #000; 
    -webkit-box-shadow:0 0 90px 5px #000; 
} 
.film_overlay .close { 
    background-image:url(http://www.destinationfjallen.se/sites/destfjallen/files/close.png); 
    position:absolute; 
    right:-15px; 
    top:-15px; 
    cursor:pointer; 
    height:35px; 
    width:35px; 
} 
</style> 

<img class="karta" src="http://www.destinationfjallen.se/sites/destfjallen/files/film1.jpg" rel="#film"/> 

<div class="film_overlay" id="#film"> 
    <iframe src="http://player.vimeo.com/video/54730694?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1" width="500" height="281" frameborder="0"webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> 
</div> 

<script> 
$(document).ready(function() { 
    $("img[rel]").overlay(); 
}); 
</script> 

我的所有幫助我能得到感謝!

+1

'.overlay()'不是jQuery的的一部分。你在使用一些插件嗎? –

+0

這不是?哦,我以爲是這樣!我遵循這個指南: http://jquerytools.org/demos/overlay/index.html – user2594856

回答

0

.overlay()不是jQuery的一部分。它是jQuery工具庫中的一個插件。你必須包括它。以下行添加到您的網頁<head>部分(後加載的jQuery):

<script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script> 
0

我不認爲$(「img [rel]」)是一個正確的選擇器。

如果要選擇具有特定rel值的圖像,你可以嘗試

$("img[rel=#film]") 

順便說我會刪除#爲您的ID (id="film"),不知道你可以用$("##film")

選擇此外rel不是img標籤的正確屬性。請參閱http://www.w3.org/TR/REC-html40/struct/objects.html#edef-IMG

+0

嗯,這也沒有工作,但無論如何謝謝你:) – user2594856

+0

試試'$(「 img「).overlay();'來查看問題是否來自選擇器。 Btw是否按照Yotam Omer的說法導入了正確的庫? –

+0

'$(「img [rel]」)'表示具有'rel'屬性的'img'對象。 「rel」的值不相關。 –