因此,我使用了jquery插件fancybox,并使其正常工作,但我想知道如何对其进行一些调整。下面是我的html:
<a id="pics" title="This is some text that displays" href="Images/test.jpg">
<img alt="pics" src="Images/test.jpg"/></a>$("a#pics").fancybox({
openEffect : 'elastic',
openSpeed : 150,
closeEffect : 'elastic',
closeSpeed : 150,
closeClick : true,
helpers : {
title : {
type : 'over'
}
}
});所以当我点击图片时,它会显示图片上的文字,这很棒。不太妙的是,当您将鼠标悬停在图片上时,所有标题文本都会出现在光标旁边(我知道title属性就是这样做的)。但是,有没有办法修改上面的html/jquery代码,以显示所有相同的内容,而不是在悬停时显示工具提示?
发布于 2012-10-01 21:14:59
显示一个带有锚的title属性内容的小工具提示是浏览器的行为。
<a id="pics" caption="This is some text that displays" href="Images/test.jpg">
<img alt="pics" src="Images/test.jpg"/></a>和fancybox选项:
$("a#pics").fancybox({
openEffect : 'elastic',
openSpeed : 150,
closeEffect : 'elastic',
closeSpeed : 150,
closeClick : true,
beforeLoad: function() {
this.title = $(this.element).attr('caption');
}
helpers : {
title : {
type : 'over'
}
}
});你可以看到a working example by fancybox。
https://stackoverflow.com/questions/12673762
复制相似问题