html + css + jquery: Toggle Show More/Less Text

后端 未结 5 2017
离开以前
离开以前 2021-01-06 17:05

I\'m working on a personal project and I\'m having a small issue:

This is my code code and currently works: http://jsfiddle.net/gvM3b/:

$(\".show-mor         


        
5条回答
  •  醉梦人生
    2021-01-06 17:40

    Here's one more solution:

    var i = 0;   
    
    $(".show-more").on('click', function() {
        $(this).text( ++i % 2 ? "(Show Less)" : "(Show More)" );
        $('.text').toggleClass("show-more-height");
    });
    

    The fiddle: http://jsfiddle.net/gvM3b/6/

提交回复
热议问题