开发者

JQuery page jumping to the top of the page

I am using this Jquery and it works great The problem is when i click on the button the page jumps all the way to the top. I am using Miva if that makes a difference

$(document).ready(function(){
        $('.drop').click(function(){
            var $next = $(this).parent().next('li开发者_运维技巧.drop_down');
            if($next.is(':visible')) {
                $next.slideUp();
            } else {
                $next.slideDown();
            }
        });
    });


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

Edit: (adding code example)

    $(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;
        });
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜