Grow your CSS skills. Land your dream job.

Hide element again

  • # March 1, 2013 at 10:08 am

    Hi
    Please help me – here : http://codepen.io/MortenAndersen/collab/cBfIs
    I’m slideTooggle some div but I can´t close the open div again?

    If I click nr. 1 I would like to close it again if I click it again

    # March 1, 2013 at 10:10 am

    I think you may have hit the wrong Codepen ‘mode’ there.

    I’m not seeing any CSS or JS….

    # March 1, 2013 at 10:14 am

    This line

    $(‘.arter-all > div’).hide();

    is causing your div#xx- to hide before it is toggled; therefore, when it is toggled it is only toggled on.

    Remove that line so that toggle can work the way you want it to.

    # March 1, 2013 at 10:52 am

    @nordstromdesign
    If I remove that line all the div would be open at once …there must be only one at a time open

    @Paulie_D
    strange ???

    # March 1, 2013 at 4:50 pm

    Collaborate view… this is normal view: http://codepen.io/MortenAndersen/pen/cBfIs

    Quick and dirty solution, exclude clicked element from the hide function: `$(‘.arter-all > div’).not(‘div#xx-‘+elementClassName).hide();`, better would be imho to keep track of which element is open and base what happens on if an element is already open or not.

    # March 1, 2013 at 5:03 pm

    @CrocoDillon

    Cool …this is working …. thanks :-)

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".