appears you are trying to use toggle with 2 functions the same way
hover works with it's 'over' function and 'out' function toggle arguments are toggle(speed,[callback]) try this: $('a.toggle').click(function(){ $(this).parents('div.portlet').children('.portlet_content').toggle(); $(this).closest(".portlet_topper").toggleClass("active"); }); Gercek Karakus wrote: Hi everyone, I am having problems with Toggle. You can see the jQuery and XHTML code below. Please let me know if you can see what's going wrong here.Thanks, $(document).ready( function() { $('a.toggle').click(function() { $(this).parents('div.portlet').children('.portlet_content').toggle (function(){ $(this).parents('div.portlet').children('.portlet_topper').addClass ('active'); }, function () { $(this).parents('div.portlet').children ('.portlet_topper').removeClass('active'); }); }); }); <div class="portlet"> <div class="portlet_topper"> <h3>1. Most Recent Comments</h3> <div class="toggle-container"><a class="toggle"></a></div> </div> <div class="portlet_content"> <p>Lorem ipsum dolor si ipiscing laoreet nibh. In hac habitasse platea dictumst. Aliquam erat volutpat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In ut justo. Nulla libero.</p> </div> </div> |
- [jQuery] Toggle Not Working Gercek Karakus
- [jQuery] Re: Toggle Not Working Charlie
- [jQuery] Re: Toggle Not Working Jeferson Koslowski