[英]Have a separate hover to the image description in fancybox 2
我在一個以二十二歲兒童主題制成的wordpress網站中使用了花式框2。 我想要它,以便當您將鼠標懸停在圖像上時會說出人員姓名,並且當您單擊圖像時它會具有幾個段落描述。 除懸停部分外,我所有工作均正常進行,當您將鼠標懸停時,它會顯示出完整的描述。
這是頁面的鏈接。 (密碼為boogiebop)
這是JavaScript:
jQuery(document).ready(function() {
jQuery(".fancybox").fancybox({
beforeshow: function(){
this.title = $(this.element).next('.newTitle').html();
},
helpers: {
title : {
type : 'inside'
}
}
}); // fancybox
}); // ready
我嘗試添加以下內容:
<a class="fancybox" href="images/01.jpg" title="only show this on hover"><img src="images/01t.jpg" /></a>
<div class="newTitle" style="display: none;"><p>hello, visite my site <a href="http://fancyapps.com/fancybox/">http://fancyapps.com/fancybox/</a></p></div>
但無濟於事,我得到的只是標准標題。
您的描述位於title屬性內,並且會顯示孔內容。 您可以添加另一個描述,例如des="blablabla"
,然后單擊圖像,將在屏幕上顯示一個模式框 ,其中包含全部內容,而des屬性將傳遞給模式框。
例:
$("#image").click(function(){
var des = $(this).attr("des");
$("#modalbox").html(des);
//done :D
})
注意:我使用了Jquery。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.