cuốn sách gpt4 ai đã làm

javascript - 使用 "more toggle"更改字体大小

In lại Tác giả: Walker 123 更新时间:2023-11-28 07:17:23 25 4
mua khóa gpt4 Nike

我正在尝试更改

$(document).ready(function() {
var ellipsestext = "...",
moretext = "More",
lesstext = "Less",
showChar;
$('.more').each(function() {
var content = $(this).html();

showChar = content.search(//);
if (content.length > showChar && showChar != -1) {

var c = content.substr(0, showChar);
var h = content.substr(showChar, content.length - showChar);

var html = c + '' + ellipsestext + ' ' + h + '  ' + moretext + '';

$(this).html(html);
}

});

$(".morelink").click(function() {
if ($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} khác {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
trả về sai;
});
});
Một {
color: #108cff;
}
a:visited {
color: #108cff;
}
a.morelink {
trang trí văn bản: không có;
phác thảo: không có;
kiểu chữ: in nghiêng;
}
.morecontent span {
hiển thị: không có;
}
.comment more {
font-size: 50px;
}










An international competition to choose the stadium’s design

architect and builders is expected to be held in November.








câu trả lời hay nhất

下面的css有错误-

.comment more{
font-size: 50px;
}

正确的做法是——

.comment.more{
font-size: 50px;
}

完整代码

$(document).ready(function() {
var ellipsestext = "...",
moretext = "More",
lesstext = "Less",
showChar;
$('.more').each(function() {
var content = $(this).html();

showChar = content.search(//);
if (content.length > showChar && showChar != -1) {

var c = content.substr(0, showChar);
var h = content.substr(showChar, content.length - showChar);

var html = c + '' + ellipsestext + ' ' + h + '  ' + moretext + '';

$(this).html(html);
}

});

$(".morelink").click(function() {
if ($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} khác {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
trả về sai;
});
});
Một {
color: #108cff;
}
a:visited {
color: #108cff;
}
a.morelink {
trang trí văn bản: không có;
phác thảo: không có;
kiểu chữ: in nghiêng;
}
.morecontent span {
hiển thị: không có;
}
.comment.more {
font-size: 50px;
}










An international competition to choose the stadium’s design

architect and builders is expected to be held in November.








关于javascript - 使用 "more toggle"更改字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32282650/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress