Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

M

Marta

@Marta
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • "Read more" button
    M Marta

    Don't worry!

    I didn't write the code correctly.
    Thank you very much, now it works perfectly!

    Merry Christmas Armin!

    Marta

    General Discussion button readmore

  • "Read more" button
    M Marta

    Hi Armin!

    In a page of my site I have a long text and I wish it was fully visible only when you click a "Read more" button.
    I first tried a pair of plug-in (Wp show more, Collapse-O-Matic), but they didn't work because the inclusion of texts in Lay Theme is different from the classic mode of Wordpress themes.
    So I tried to insert a button through the codes, and the only system that seems to work is this:
    https://codepen.io/devkick/pen/soJpy

    HTML and CSS parts work well, but I can't integrate the Js part. I paste the Js code in "Custom <head> content", in a script tag and put "JQuery" instead of "$", but it still does not work.

    Original script:
    $(".readmore").on('click touchstart', function(event) {
    var txt = $(".more-content").is(':visible') ? 'Show more (+)' : 'Less (–)';
    $(this).parent().prev(".more-content").toggleClass("visible");
    $(this).html(txt);
    event.preventDefault();
    });

    My version:
    <script>
    jQuery(".readmore").on('click touchstart', function(event) {
    var txt = jQuery(".more-content").is(':visible') ? 'Show more (+)' : 'Less (–)';
    jQuery(this).parent().prev(".more-content").toggleClass("visible");
    jQuery(this).html(txt);
    event.preventDefault();
    });
    </script>

    My page: http://fabrizioinglese.com/bio-di-prova

    Did I do something wrong?
    Is there another way to insert the button?

    I hope you give me a solution!
    Thanks for the help and for the theme,

    Marta

    General Discussion button readmore
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Recent
  • Tags
  • Popular
  • Users
  • Search