Closed Loosie94 closed 2 years ago
This one works but I don't think this is ideal.
ReadMore.settings = function(){
return {
content: document.querySelectorAll('.js-read-more'),
originalContentArr: [],
truncatedContentArr: [],
moreLink: "Read More",
lessLink: "Show less",
}
}
ReadMore.init()
Took me a sec to get around to improving the api for this lib, but finally did.
Now, with v2 you can now pass in options, which include editing the read more / read less text.
import ReadSmore from 'read-smore'
const readMores = document.querySelectorAll('.js-read-smore')
const options = {
blockClassName: 'read-more',
moreText: '"Some custom read more',
lessText: 'Some custom read less'
}
ReadSmore(readMores, options).init()
I documented this in the Readme and added a Docs/Demo page
Hi, love your read-more solution but I can't seem to change the text values within the trigger. I did the following:
What am I doing wrong?