I have an anchor link that points to a field that is inside a collapsible panel (it could be inside a panel that is inside a panel). I have code that when the user clicks on the anchor link, all the parent panels will open if it's hidden and scroll to the field by using jQuery offset().top. However, the value from offset() is not updated after the panel is open. Some sample code:
$anchor.click(function() {
$.each($panels, function(key, panel) {
if (\\ panel is closed) {
$(panel).collapse('show');
}
})
$('html,body').animate({scrollTop: $(this.hash).offset().top}, 'slow');
});
How to fix this issue?