user3591872
user3591872

Reputation: 47

Slidetoggle Not working properly on child element of the parent

On clicking .cart-contents-toggle the #cartplus-dropdown div should slide down and at the same time slide up without clicking on it a second time. Here is the URL where this is implemented: Website Link

jQuery(document).ready(function() {
  jQuery('#cartplus-dropdown').hide();
  jQuery('.cart-contents-toggle').on("click", function() {
    jQuery('#cartplus-dropdown').slideToggle();
  });
});

Upvotes: 0

Views: 169

Answers (2)

user3591872
user3591872

Reputation: 47

Tried this and working now

jQuery('.c-btn').mouseenter(function(e) {
  jQuery('.cartplus-dropdown').slideDown();
  e.stopPropagation();
});
jQuery('.c-btn').mouseleave(function(e) {
  jQuery('.cartplus-dropdown').slideUp();
  e.stopPropagation();
});

Upvotes: 0

Shankar Mahato
Shankar Mahato

Reputation: 65

Please use the updated code below and let me know if you have any issue or query.

jQuery(document).ready(function() {
 jQuery('.cart-contents-toggle').on("click", function() {
   jQuery('#cartplus-dropdown').toggle();
    jQuery('#cartplus-dropdown').slideToggle();

  });
});

Hope this may be helpful to you.

Upvotes: 1

Related Questions