1

For open minicart on click i wrote:

<div class="mini-cart" style="cursor:pointer;"></div>


<script type="text/javascript">
jQuery(function($){
    $('.mini-cart').click(function(){
        $('.topCartContent').toggle();

    })
});
 </script>

but there is a problem in script jquery. If i go down with the scroll, and then i go up, the script not work. What the problem?

1 Answer 1

0

Maybe the problem is that jQuery not found the class .mini-cart in DOM try run the script when document is ready:

<div class="mini-cart" style="cursor:pointer;"></div>

<script type="text/javascript">
    jQuery(function($){
        $( document ).ready(function() {
            $('.mini-cart').click(function(){
                $('.topCartContent').toggle();
            })
        });
    });
</script>

Example: https://jsfiddle.net/bk09sbba/3/

1
  • same problem. the minicard open once yes and once no Commented Oct 28, 2016 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.