jQuery GalleryView支持links / href

时间:2010-10-26 16:59:45

标签: jquery slideshow galleryview

我已升级到jQuery GalleryView 2.1.1,它似乎不支持图像上的ahref标记。这有解决方法吗?我希望能够在图像鼠标悬停上显示标题并重定向到另一个页面onclick。

2 个答案:

答案 0 :(得分:3)

  
$('#gallery .panel img').hover(function() {
    $(this).wrap('<a href="' + this.src + '" target="_blank"/>');
}, function() {
    $(this).unwrap('<a></a>');
});

答案 1 :(得分:1)

这就是我所做的:我使用面板叠加作为要点击的对象 我添加了一个A标签,所以我可以使用它的href属性(见下文)

<li><span class="panel-overlay"><a href="your_link_here" ></a></span><img  src="pic.jpg"  alt=""/></li>  

在css文件中我确保面板覆盖覆盖整个图像并使其透明。还为其添加了一个手形光标。

.panel .overlay-background { height: 666px; cursor:pointer;background: none; }

最后,在页面的$(document).ready函数中我添加了:

   $(".panel-overlay").click(function() {
    //get the link href 
    var link = jQuery("a", this).attr('href');
    window.location.href = link;
   });  

希望这可以帮助那些人..
欢呼: - )