READ MORE ... still not a standard code
-
Hi, i am trying to figure out how to have a simply READ MORE button in a text, to hide and show longer texts.
the standard plugins dont work, and my research on this forum, the only answer is always the same one"did you have a look here?
http://laytheme.com/documentation.html#custom-javascript
Because your Lay Theme website is a "Single Page" JavaScript application you cannot just use jQuery(document).ready(…) to execute your js because the ready event only fires once when the website loads the first time."
that means nothing to me,
Can you help?
Thanks -
Dear @darioj
Instead of the " jQuery(document).ready(…)" you need to wrap it in a Newpage event.
window.laytheme.on("newpageshown", function(){ // - INSERT DESIRED CODE HERE });Also the Common JQuery abbreviation "$" must be altered to 'jQuery' eg.
window.laytheme.on("newpageshown", function(){ $("button").click(function(){ $("p:first").addClass("intro"); }); });is now:
window.laytheme.on("newpageshown", function(){ jQuery("button").click(function(){ jQuery("p:first").addClass("intro"); }); });It depends also how you want this 'Read-more' to function,
You could have a hidden text box that when clicked simply makes it visible but very similar to this the commonly used Accordion - which will open nicely:
https://www.w3schools.com/howto/howto_js_accordion.asp
Is this what you were asking for? :)
Best Wishes and Seasons GreetingsRichard
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login