0
Вот мой рабочий код, чтобы свернуть поля и прокручивать их якорь плавно, но иногда есть прыжок перед прокруткой, что не очень гладко.муха в мазе на гладкой странице прокрутки с jQuery
function smoothScrollTo(element) {
var thisTop = $($(element).parent()).offset().top;
$("html, body").animate({
scrollTop: thisTop + "px"
}, {
duration: 600
});
return false;
};
$(document).ready(function() {
$(".collapsible .collapsed").hide();
$(".collapsible legend").html(function() {
var scroll = $(this).parent().hasClass('scroll');
if (scroll == true) {
href = "#" + $(this).parent().attr('id');
} else {
href = "javascript:void(0)";
};
return '<a href="' + href + '">' + $(this).html() + '</a>';
}).click(function() {
$(this).parent().children('.content').slideToggle();
});
$(".collapsible.scroll legend").click(function() {
smoothScrollTo(this);
});
});
Я нашел решение: e.preventDefault();
необходимое для прокрутки отлично
окончательный код: http://jsfiddle.net/eapo/v6URL/2/