JQuery page at the top of the page

I use this jQuery and it works great. The problem is that when I click the button, the page jumps to the very top. I use Miva if that matters

$(document).ready(function(){
        $('.drop').click(function(){
            var $next = $(this).parent().next('li.drop_down');
            if($next.is(':visible')) {
                $next.slideUp();
            } else {
                $next.slideDown();
            }
        });
    });
+3
source share
1 answer

Try adding "return false" to the end of your click () function.

Edit: (add code)

    $(document).ready(function(){
        $('.drop').click(function(){
            var $next = $(this).parent().next('li.drop_down');
            if($next.is(':visible')) {
                $next.slideUp();
            } else {
                $next.slideDown();
            }

            return false;
        });
    });
+10
source

Source: https://habr.com/ru/post/1754273/


All Articles