Treehouse: Grow your CSS skills. Land your dream job.

add removing class on click once and again.

  • # August 19, 2011 at 4:07 pm

    howcome it doesn’t work with .click but it works with hover? it doesn’t make sense. what i want is when you hover over a list item, then there’s the hover color, then when you click i have a div appear (sliding down) then i want the LI #Show to have a yellow background-color then when clicked again the div goes away Display:hidden) and then i want the LI#Show to go back to its regular state. but i canonly get so far. where if the li is clicked once, then the div appears and the li background goes yellow, but once i click it again the div dissappears but the color does not go away.

    # August 19, 2011 at 5:39 pm

    what do you have so far?

    # August 19, 2011 at 5:53 pm
    # August 20, 2011 at 12:45 am

    OH MY GOODNESS thank you soo much! i had no idea you could toggle a CLASS! wow. love jQuery. still learning. :) well.. just learning haha. but thank you so much. much appreciated.

    # August 20, 2011 at 3:47 pm

    I was going to submit a response as I thought I had a good answer. I too did not know of ‘toggleClass()’

    +1 for learning!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.