});
$(".woocommerce-LoopProduct-link").each(function() {
- // This makes fancybox not work
- //$(this).attr("href", "#");
-
- // Fancybox works but <a> is display: none on image click
- //$(this).attr("href", "");
-
- // Not doing anything leaves the link active
- });
-
-
- $(".woocommerce-LoopProduct-link").on("click",function( event ) {
- // Doing this makes fancybox not work
- //event.preventDefault();
+ // Removing all the anchors from the products so that you won't
+ // navigate away when clicking in one, allowing fancybox to display
+ $(this).attr("href", "");
});
-
$(".woocommerce-LoopProduct-link").fancybox({
helpers: {
overlay: { locked: false,
},
title: { type: 'inside'},
+ },
+ afterLoad: function(){
+ this.title = $(this.element).find('img').attr('alt');
+ },
+ afterClose: function() {
+ $(this.element).show();
}
});
});
$(".woocommerce-LoopProduct-link").each(function() {
- // This makes fancybox not work
- //$(this).attr("href", "#");
-
- // Fancybox works but <a> is display: none on image click
- //$(this).attr("href", "");
-
- // Not doing anything leaves the link active
- });
-
-
- $(".woocommerce-LoopProduct-link").on("click",function( event ) {
- // Doing this makes fancybox not work
- //event.preventDefault();
+ // Removing all the anchors from the products so that you won't
+ // navigate away when clicking in one, allowing fancybox to display
+ $(this).attr("href", "");
});
-
$(".woocommerce-LoopProduct-link").fancybox({
helpers: {
overlay: { locked: false,
},
title: { type: 'inside'},
+ },
+ afterLoad: function(){
+ this.title = $(this.element).find('img').attr('alt');
+ },
+ afterClose: function() {
+ $(this.element).show();
}
});