我有这个jQuery脚本,每个案例中的脚本都会显示更多/更少的按钮。对于小于80px的内容,我不会隐藏更多/更少的按钮。怎么做?谢谢
$(function(){
// The height of the content block when it's not expanded
var adjustheight = 80;
// The "more" link text
var moreText = "Show more";
// The "less" link text
var lessText = "Close";
// Sets the .more-block div to the specified height and hides any content that overflows
$(".more-less .more-block").css('height', adjustheight).css('overflow', 'hidden');
// The section added to the bottom of the "more-less" div
$(".more-less").append('<a href="#" class="adjust"></a>');
$("a.adjust").text(moreText);
$(".adjust").toggle(function() {
$(this).parents("div:first").find(".more-block").css('height', 'auto').css('overflow', 'visible');
// Hide the [...] when expanded
$(this).parents("div:first").find("p.continued").css('display', 'none');
$(this).text(lessText);
}, function() {
$(this).parents("div:first").find(".more-block").css('height', adjustheight).css('overflow', 'hidden');
$(this).parents("div:first").find("p.continued").css('display', 'block');
$(this).text(moreText);
});
});
答案 0 :(得分:2)
在添加adjust div之前,您可以将代码包装在检查高度的条件中:
System.Data.DbType.Date