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

后端 未结 5 2014
离开以前
离开以前 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:44

    Like this:

    $(".show-more").click(function () {        
        $(".text").toggleClass("show-more-height");
        if(!$(".text").hasClass("show-more-height")){
            $(this).text("Show Less");
        }else{
            $(this).text("Show More");
        }
    });
    

    ​ updated fiddle

提交回复
热议问题