- This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
Viewing 10 posts - 1 through 10 (of 10 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › "Now you see me" and keep seeing me
Regarding the display: none writeup (https://css-tricks.com/places-its-tempting-to-use-display-none-but-dont/), I’d like to know how to use this more than once on a page.
For instance, I have a page of bios, and the design calls for each bio to initially only show the first paragraph, then optionally click “show more” to expand the rest.
It’s not clear what the actual issue here is but JS/JQ will let you target individual elements for the same function.
Do you have a brief example you could show us in Codepen.io?
Just picture:
Bio one. (read more)
Bio two. (read more)
etc.
The script as it is will effect all the show/hide content, instead of one treating them individually.
I can picture it…now if you provide the code we can make a start…but your starter is with the Jquery this
keyword.
Ah right, that’s in the script I often use:
The problem with it though is the fact that it simply uses display: none.
My Jquery is poor but
Hmm, looks close, but now they won’t close.
I just used the script from the article linked…which, as I recall, did not include a ‘closing’ option.
It suggested a method not a complete solution.
I’m sure you can figure out a way to adapt what you have to toggle open and closed.
Thanks for the help, I’ll keep at it.