首页 > 语言 > JavaScript > 正文

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

2024-05-06 15:49:46
字体:
来源:转载
供稿:网友
渐变显示渐变消失的特殊效果在使用中还是比较常见的,本文简单的实现了一个,大家如何需要可以参考下

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

复制代码 代码如下:


function showAccomplishmentTableRow(){
$("#accomplishmenttable tr:hidden").first().show(2000,function(){
showAccomplishmentTableRow();
});
if($("#accomplishmenttable tr:hidden").size()==0){
$("#accomplishmenttable").next().attr("onclick","hideAccomplishmentTableRow()").text("Less");
}
}
function hideAccomplishmentTableRow(){
if($("#accomplishmenttable tr:visible").size()<=3){
$("#accomplishmenttable").next().attr("onclick","showAccomplishmentTableRow()").text("More");
return;
}

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

}


html

复制代码 代码如下:


<table>
<tbody>
<tr>
<th colspan="2">MY ACCOMPLISHMENTS</th>
</tr>

<tr>
<td>
<div>border_bottom1Pgreye7e7e7</div>
</td>
<td>
border_bottom1Pgreye7e7e7
</td>
</tr>
<tr>
<td>
<div>border_bottom1Pgreye7e7e7</div>
</td>
<td>
border_bottom1Pgreye7e7e7
</td>
</tr>
</tbody>
</table>
<div>More</div>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选