I've upgraded to jQuery GalleryView 2.1.1 and it doesn't seem to开发者_如何学Go 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.
- demo: https://so.lucafilosofi.com/jquery-galleryview-support-for-links-href/
$('#gallery .panel img').hover(function() {
$(this).wrap('<a href="' + this.src + '" target="_blank"/>');
}, function() {
$(this).unwrap('<a></a>');
});
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 :-)
精彩评论