Forums

Give help. Get help.

  • # October 20, 2017 at 2:56 am

    Hi,

    My jQuery doesn’t work.

    I would like that if I click one question, the text would be visible. and if I click there again, it should be invisible again.
    And the other thing, I would like that only one text of question would be visibly in one time.

    # October 20, 2017 at 3:25 am

    You can’t animate a height to auto either in CSS or JS.

    I’d suggest you use another reveal method.

    # October 20, 2017 at 4:49 am

    I changed the code.

    It works only the height is “auto” as default, but I would like it “0”.

    The other thing, I would like that if I click one of question, then the other closes.

    # October 20, 2017 at 4:55 am

    You’need to include a function to select all the .question elements that are not $this and close the child elements.

    https://stackoverflow.com/questions/437958/jquery-exclude-this-from-selector

    # October 20, 2017 at 5:09 am

    Actually I have no idea how it works.
    There is no height: 0 in the code, but it does close! How?

    # October 20, 2017 at 5:52 am

    Never mind, there seems to be more to the question…

    # October 20, 2017 at 6:02 am

    I am sorry, in meantime I have changed the code. :)
    I am almost there.
    Now my main problem is that the “$(this).next()” doesn’t work.
    I want to reach the div “.more” after the div “.question”.

    # October 20, 2017 at 7:08 am

    Hi Ayala, is this the functionality you are looking for?

    I made the .more divs children of their respective .question divs (I think it simplifies the js) .

    Also, if you’re using jquery you need to make sure that the library is linked. In code pen you can do this by opening the js settings and selecting jquery under add external javascript.

    # October 20, 2017 at 7:22 am

    Edit – didn’t see bearhead’s post (looks more straightforward)…

    And I messed something up meanwhile anyway. :-)

    # October 20, 2017 at 8:46 am

    Almost.
    I would like to close both.

    # October 20, 2017 at 8:58 am

    I’ve updated my pen to allow both to be closed at the same time.

    # October 20, 2017 at 9:48 am

    Thank you!
    It is perfect! :)

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

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag