Selecting one product with jQuery
-
Right now I am trying to customize WooCommerce archive-product.php with my jQuery codes. Most things seem to work but need some help finishing my work.
What I am trying to do is making sure a div is showing up with product details once you mouse-over a product on the archive-product page and on the archive-product-categories pages. It do is showing a div whenever I am hovering over a product, but if I hover over ONE product all the divs correspending all products are showing up.
Meaning, whenever I am hovering over the first product, the divs of product 2, 3, 4, 5 etc are showing as well. How can I make sure that whenever I am hovering a product only THIS product is showing the hidden div with extra information?
This is the code I am using:
PHP:<li <?php post_class( $classes ); ?>></p>
<p> <?php do_action( ‘woocommerce_before_shop_loop_item’ ); ?></p>
<p> ” class=”product-images”></p>
<p> <?php
/**
* woocommerce_before_shop_loop_item_title hook
*
* @hooked woocommerce_show_product_loop_sale_flash – 10
* @hooked woocommerce_template_loop_product_thumbnail – 10
*/
do_action( ‘woocommerce_before_shop_loop_item_title’ );
?></p>
<p>
<?php
/** this piece of code is specially ment for the pop-up to show
*
* @hooked will be specified later
* @hooked will be specified later
*/
?>
<div class=”popup-product-custom” style=”border: 1px solid black; position: absolute; top: 0px; width: 100%; height: 75%; margin-left: 250px; z-index: 2147483647; background-color: #FFFFFF;”>” class=”button-in-popup”>This is a test button</div>And jQuery which is being called:
<script>
jQuery(document).ready(function() {</p>
<p> jQuery(“.popup-product-custom”).hide();</p>
<p> jQuery(“.post-type-archive-product .product-type-simple, .archive.tax-product-cat .product-type-simple”).hover(function() {
jQuery(“.popup-product-custom”).slideToggle();
});
});
</script>Hope you can figure something out, thanks in advance.
- The topic ‘Selecting one product with jQuery’ is closed to new replies.