JQuery accordion won't bring back default panel -


this not jquery ui accordion, show/hide script. list of links supposed toggle divs corresponding anchors.

my problem first link , initial div, displays default, won't come after has been hidden. javascript:

$('.active').click(function() {     return false; }); $('.ready').click(function() {      var accordionid = $(this).attr("href");      // links either 'active' or 'ready'      $('.active').removeclass('active').addclass('ready');     $(this).removeclass('ready').addclass('active');      // panels have class 'showing' if display     $('.showing').slidetoggle().removeclass('showing');     $(accordionid).slidetoggle().addclass('showing');       return false; }); 

i have fiddle here shows problem: http://jsfiddle.net/g0e00l2p/

i'd expect script fire on links have 'ready' class. reason fires on links have 'active' class.

since weren't using event delegation monitor changes dom (commonly done via on() method), jquery knew of elements saw them on initial page load. wasn't aware classes had changed perspective of click function, static object.

all class toggling can eliminated. jquery you.

$('#accordion li a').click(function (e) {     var accordionid = $(this).attr("href");      $('.resume-content').not(accordionid).slideup();     $(accordionid).slidedown();      e.preventdefault(); }); 

demo

note added overflow statement css eliminate slide jump.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -