Forums

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

Home Forums JavaScript Read more and less

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #160258
    kevsyers
    Participant

    So I’ve been scouring the internet for a way to have a ‘read more’ button on text that I want partially hidden. I figured this out but I am now having issues with reversing this with a ‘read less’ button.

    One caveat is I can’t just hardcode the button within the text. It needs to be on a container surrounding the text.

    Here’s what I have so far:
    http://codepen.io/kevsyers/pen/myJtz

    Any help would be much appreciated.

    #160262
    Chromawoods
    Participant

    I forked your pen and made a jQuery function that you can apply. Note that the function takes a shouldExpand param, so you can also init wrappers initially expanded, if you want.

    http://codepen.io/chromawoods/pen/nHJDE

    #160264
    kevsyers
    Participant

    Well, that pretty much solves that problem. Since I don’t have anything to give you, let’s pretend that we’re giving each other fist-bumps and looking cool. Perhaps walking down the street in slow-mo with some sick 80s big-hair band guitar riffs screeching on our boom box.

    Thanks!

    #160277
    Chromawoods
    Participant

    LOL! Best mental image ever.

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