Reputation: 35
I have the following accordion working but having trouble figuring out how to make the first item not scroll to first item position which is on the middle of the page.
I want the following items in the accordion to scroll up to next item start when clicked. Also when any item is opened and closed the code no longer works.
But if you select items without closing open item then code works smoothly. Thanks for any assistance.
$("#accord_holder").accordion({
autoHeight: false,
collapsible:true,
navigation:true,
active:false,
change: function(event, ui) {
$(window).scrollTop(ui.newHeader.position().top - 1);
}
});
Upvotes: 0
Views: 405
Reputation: 12797
Here is the error
change this
$(window).scrollTop(ui.newHeader.position().top - 1);
into
$(window).scrollTop(ui.newHeader.position.top - 50);
Updated your fiddle http://jsfiddle.net/rwyvh/37/
Upvotes: 1
Reputation: 19212
$("#accord_holder").accordion({
autoHeight: false,
collapsible:true,
navigation:true,
active:false,
change: function(event, ui) {
//this might work
$(this).scrollTop($(this).scrollHeight);
}
});
Upvotes: 0