on-internet
← Community

Can't seem to get jQuery slidetoggle to start off closed

Stack Overflow ·

I am using a jQuery slidetoggle on a single page website. I have been trying to figure out where I went wrong in my script but can't seem to resolve this issue. I am trying to get the slide toggle effect to start off closed when the page opens and open/close only on click. Right now, when the page opens each section of the slide toggle is already open. <script type="text/javascript"> jQuery(function($) { var openText = 'Open'; var closeText = 'Close'; $('.item-util .more-toggle').toggle( function() { $(this).html(closeText); $(this).parent().siblings('div').slideToggle('slow'); }, function() {

Comments

Sign in or sign up to comment and upvote.

No comments yet.