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
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it