0

我在一个由 22 岁儿童主题制成的 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>

但无济于事,我得到的只是标准标题。

4

1 回答 1

0

您的描述在标题属性内,当然它会显示孔内容。您可以添加另一个描述,例如des="blablabla",单击图像后,屏幕上将显示一个模态框,其中包含 des 属性的全部内容将传递给模态框。

例子:

$("#image").click(function(){

var des = $(this).attr("des");

$("#modalbox").html(des);
//done :D
})

注意:我使用了 Jquery。

于 2013-04-30T13:31:27.900 回答