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;
});
});
精彩评论