【问题标题】:Have a separate hover to the image description in fancybox 2将鼠标悬停在 fancybox 2 中的图像描述上
【发布时间】:2013-04-30 12:03:29
【问题描述】:

我在一个由 22 岁儿童主题制成的 wordpress 网站中使用了精美的 box 2。我想要它,这样当您将鼠标悬停在图像上时,它会显示人名,当您单击图像时,它将有几段描述。除了悬停部分,我什么都可以工作,当你悬停时,它会显示整个大描述。

Here is a link to the page.(密码是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>

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

【问题讨论】:

标签: javascript jquery wordpress fancybox-2


【解决方案1】:

你的描述在标题属性里面,当然它会显示洞的内容。您可以添加另一个描述,如des="blablabla",一旦您单击图像,屏幕上将显示modal box,其中des 属性的全部内容将传递到模态框。

例子:

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

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

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

注意:我使用的是 Jquery。

【讨论】:

  • 您好,您认为我不应该使用花哨的框而使用模态框吗?我不担心在描述中有href链接,只是想让悬停说出人名,然后点击图片下方的描述......
  • 一样,fancybox 只是 css 样式。您必须插入一个像 div 一样的 html 标记,一旦您单击图像,它将采用属性 des 的值(或另一个具有您想要的名称的值)和 api.jquery.com/html/">.html() 函数 写在 div 里面。
  • 哦,别担心:D。没关系
猜你喜欢
  • 2017-03-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-11
  • 2011-06-26
  • 1970-01-01
相关资源
最近更新 更多