var FanHui = '<a οnclick="CloseAutoHeight()">返回</a>';
function AutoHeight(){
var TeamLeftP = $(".teamleft > ul > li > p");
TeamLeftP.click(function(){
var ThisPL = $(this).text().length;
if(ThisPL > 650){
$(this).addClass('phover');
}
$(this).parents('li').addClass('BlockLi');
$(".teamleft > ul > li").siblings().addClass('NoneLi'); //同辈元素
$(this).parents('li').children('em').append(FanHui); //父辈元素以及子元素
//document.body.scrollTop=0;
window.scroll(0,0); //滚动条位置
})
}
function CloseAutoHeight(){
var TeamLeftP = $(".teamleft > ul > li > p");
TeamLeftP.removeClass('phover');
$(".teamleft > ul > li").removeClass('NoneLi');
$(".teamleft > ul > li").removeClass('BlockLi');
$(".teamleft > ul > li > em > a").remove();
}
简单的jquery效果
最新推荐文章于 2021-02-06 21:08:10 发布