javascript

位置:IT落伍者 >> javascript >> 浏览文章

js渐变显示渐变消失示例代码


发布日期:2019年05月21日
 
js渐变显示渐变消失示例代码
渐变显示渐变消失的特殊效果在使用中还是比较常见的本文简单的实现了一个大家如何需要可以参考下

以下是渐变的js代码(表示多余三行的要隐藏点击"more"显示剩下的点击“less”要逐渐隐藏)

复制代码 代码如下:
function showAccomplishmentTableRow(){
$("#accomplishmenttable tr:hidden")first()show(function(){
showAccomplishmentTableRow();
});
if($("#accomplishmenttable tr:hidden")size()==){
$("#accomplishmenttable")next()attr("onclick""hideAccomplishmentTableRow()")text("Less");
}
}
function hideAccomplishmentTableRow(){
if($("#accomplishmenttable tr:visible")size()<=){
$("#accomplishmenttable")next()attr("onclick""showAccomplishmentTableRow()")text("More");
return;
}

$("#accomplishmenttable tr:visible")last()hide(function(){
hideAccomplishmentTableRow();
});

}


html

复制代码 代码如下:


<table id="accomplishmenttable" class="bgWhite borderPGreyeee marginT roundedCorner widthP">
<tbody>
<tr class="bgLightGreyfff height">
<th class="border_bottomPgreyeee border_rightPgreyeee border_topPWhite fontGreyGeneral textCenter roundedCorner_TL verticalMiddle widthP" colspan="">MY ACCOMPLISHMENTS</th>
</tr>

<tr class="bgWhite height">
<td class="border_bottomPgreyeee border_rightPgreyeee fontGreyGeneral pFont widthP">
<div class="margin">border_bottomPgreyeee</div>
</td>
<td class="border_bottomPgreyeee border_rightPgreyeee fontGreyGeneral pFont textLeft widthP">
border_bottomPgreyeee
</td>
</tr>
<tr class="bgWhite height">
<td class="border_bottomPgreyeee border_rightPgreyeee fontGreyGeneral pFont widthP">
<div class="margin">border_bottomPgreyeee</div>
</td>
<td class="border_bottomPgreyeee border_rightPgreyeee fontGreyGeneral pFont textLeft widthP">
border_bottomPgreyeee
</td>
</tr>
</tbody>
</table>
<div class="floatR marginT pFont textLink" onclick="showAccomplishmentTableRow();">More</div>

上一篇:纯JavaScript实现HTML5 Canvas六种特效滤镜示例

下一篇:jquery动态加载js三种方法