Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

jQuery expand/collapse works but...

Featured Replies

Hi, I've added this cool piece of jQuery to this site (scroll to the bottom and you will see those carbon fiber bars to expand/collapse the divs). It works great, apart from when the expand initiates, it skips the first 30px or so and then skips that same first 30px of the div when it collapses too. It looks really notchy?

 

Does anyone know what I could do to fix this?

 

Also, how do I get them to start collapsed, rather than start expanded?

 

http://www.multitraxpro.co.uk/pt-academy/trainingcourses.html

 

Cheers.

 

Rich

Edited by futureproof

  • Author

Wicked Andy, thanks for that. Do you know how I can start the page with all the divs collapsed?

HTML:

<div id="cat" class="toggleCat">
   <div class="content">
       <p>Blah...</p>
   </div>
</div>

 

Put into <script> tags in <head>

$(document).ready(function(){
   $(".toggleCat").css("display", "none");
});

 

Not 100% sure this will work with that plugin you've got. That plugin seems hugely unnecessary - you can do everything you're using it for with one word of jQuery: .slideToggle()

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.