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?

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/

| improve this answer | |
  • same problem. the minicard open once yes and once no – Alessandro Gnola Oct 28 '16 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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