Jquery scrollTop behaving oddly with JqueryUI Accordion -
have list of stores in accordion control inside height constrained div , trying scroll active panel view.
$("#stores").accordion({ heightstyle: "fixed", icons: false, activate: function (event,ui) { $("#stores").scrolltop($(ui.newheader).position().top-5); } }); this should bring newly activated header , it's accompanying panel top of parent div 5px margin doesn't... has been driving me crazy days
try
$(document).ready(function () { $("#stores").accordion({ heightstyle: "fixed", icons: false, activate: function (event,ui) { var scrolltop = $("#stores").scrolltop(); var top = $(ui.newheader).offset().top; $("#stores").scrolltop(scrolltop + top -5); } }); }); demo: fiddle
Comments
Post a Comment