我需要在jQuery中创建read more函数,例如,当字符长度为30时显示文本,但是当字符更多时,仅显示30个字符。
$('.dep_buttons').mouseover(function(){
// please insert script here
$(this).stop().animate({height:"100px"},150); // when character > 30 need this
$(".dep_buttons").mouseout(function(){
$(this).stop().animate({height:"30px"},150);
});
});
最佳答案
if($('your class').text().length() > 30) {});
你需要这个脚本