我現在用的是下頁稱爲capSlide一個jQuery腳本請疊加jQuery中
http://sundial.whistlerwebhosting.com/meetings-events/whistler-weddings
當通過圖像的透明疊加出現在頂部和標題用滑了用戶移動鼠標標題和更多信息鏈接。
我想讓整個div區域可點擊。我在想,因爲覆蓋層出現在它的這個div上面,我需要使鏈接處於活動狀態。我正在嘗試使用下面的jquery腳本,但它不起作用。
jQuery('.overlay').click(function(){
window.location=jQuery(this).parent().find('a').attr('href');
return false;
});
的HTML輸出如下
<div class="ic_wrapper">
<div id="capslide_img_cont11" class="ic_container"><img typeof="foaf:Image" src="/sites/all/themes/sundial/images/weddings/Wedding-Consulants.jpg" width="290" height="180" alt="Whistler Wedding Consulants" />
<div class="overlay" style="display:none;"></div>
<div class="ic_caption">
<h3>Wedding Consulants</h3>
<a href="/meetings-events/whistler-weddings/wedding-planners">
<p class="ic_text">More Info</p>
</a> </div>
</div>
</div>
任何見解將不勝感激
感謝您的建議我已經厭倦了這一點,但仍然沒有喜悅。在上面的示例中,.parent的用法仍然正確。實際的href位於.ic_container div而不是它的父級。或者,這是從overlay的角度來看的。 – 2012-07-13 01:58:13
在我的例子中'this'的值是指'.overlay'選擇器 – Jlange 2012-07-13 18:18:09