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?

osrecio
  • 1,628
  • 10
  • 16
Alessandro Gnola
  • 175
  • 2
  • 13

1 Answers1

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/

osrecio
  • 1,628
  • 10
  • 16