Tuesday 15 April 2014

jquery - Close ajax accordion with javascript -



jquery - Close ajax accordion with javascript -

i have ajax accordion on want close after 5 seconds page loading. i'm trying javascript having no luck. i'm trying alter accordion command of selectedindex value collapse accordion. selectedindex = 0 open (default), , i'm trying alter 1 after javascript timer runs out.

$(document).ready(function () { // close accordion after 5 seconds settimeout(function () { document.getelementbyid('maincontent_accordion1').selectedindex = 1; }, 5000); });

i'm not getting errors on java console, accordion isn't closing. thoughts?

i found works.

settimeout(function () { var behavior = $get("<%accordion1.clientid%>").accordionbehavior; behavior.set_selectedindex(1);}, 5000);

this solution wanted, in behaves if user clicked accordion button. other solutions found instantaneous hide , not animate collapse of accordion. setting index value higher maximum number, in effect collapses accordion. in case have 1 pane, setting index 0 1 trick.

javascript jquery asp.net ajax

No comments:

Post a Comment