jQuery GalleryView 对链接/href 的支持

发布于 2024-09-29 00:04:32 字数 98 浏览 0 评论 0原文

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

I've upgraded to jQuery GalleryView 2.1.1 and it doesn't seem to support ahref tags on the images. Is there a workaround for this? I want to be able to display the title on image mouseover and redirect to another page onclick.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半衬遮猫 2024-10-06 00:04:32
$('#gallery .panel img').hover(function() {
    $(this).wrap('<a href="' + this.src + '" target="_blank"/>');
}, function() {
    $(this).unwrap('<a></a>');
});
$('#gallery .panel img').hover(function() {
    $(this).wrap('<a href="' + this.src + '" target="_blank"/>');
}, function() {
    $(this).unwrap('<a></a>');
});
不寐倦长更 2024-10-06 00:04:32

这就是我所做的:我使用面板覆盖作为要单击的对象。
我向它添加了一个 A 标签,这样我就可以在 css 文件中使用它的 href 属性(见下文),

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

我确保面板覆盖覆盖整个图像并使其透明。还向它添加了一个手形光标。

.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;
   });  

希望这可以帮助那里的人..
干杯:-)

here is what i did: i used the panel-overlay as the object to be clicked.
i added an A tag to it so i can use its href attribute (see bellow)

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

in the css file i made sure the panel-overlay covered the entire image and made it transparent.also added a hand cursor to it.

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

finally, inside the page's $(document).ready function i added:

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

hope this helps someone out there..
cheers :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文