The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Problem with jQuery .removeClass()

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #44868

    The above pen illustrates a way to make a responsive layout that includes a sidebar. When the final breakpoint is met, the navigation disappears, and a navigation icon appears. When the icon is clicked, the navigation appears. I accomplished this with jQuery, and I’m using .addClass() to add class “close” to the icon so that, after the navigation is opened, when it is clicked on the navigation closes. It works, until you do it a second time. The second time around, the navigation opens and immediately closes. It seems as if the class “close” is not being removed after the first second click. Feedback/help is appreciated, thanks.


    Check out these:

    1.) toggleClass( )

    2.) hasClass( )


    Thanks John. I was able to get it working with toggleClass().

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.