国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

基于replaceChild制作簡單的吞噬特效

2019-11-20 11:32:42
字體:
來源:轉載
供稿:網友

效果演示圖:

源   碼   查   看

【HTML代碼說明】

<ul class="list" id="list">  <li class="in">1</li>  <li class="in">2</li>  <li class="in">3</li>  <li class="in">4</li>  <li class="in">5</li>  <li class="in">6</li>    </ul>

【CSS代碼說明】

.in{  height: 20px;  line-height: 20px;  width: 20px;  background-color: blue;  text-align: center;  color: white;}

【JS代碼說明】

<script>var oList = document.getElementById('list');//新增一個li元素var oAdd = document.createElement('li');//設置新增元素的css樣式oAdd.className = "in";oAdd.style.cssText = 'background-color:red;border-radius:50%';//1s后oAdd替換第0個lisetTimeout(function(){  oList.replaceChild(oAdd,document.getElementsByTagName('li')[0]);  //1s后執行incrementNumber函數  setTimeout(incrementNumber,1000);  },1000);function incrementNumber(){  //獲取oList中第1個li  var oLi1 = document.getElementsByTagName('li')[1];  //若存在則進行替換處理  if(oLi1){     oList.replaceChild(oAdd,oLi1);     setTimeout(incrementNumber,1000);      }}</script>

以上內容給大家分享了基于replaceChild制作簡單的吞噬特效,希望大家喜歡。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 虎林市| 慈溪市| 新竹市| 晋宁县| 宿州市| 龙井市| 屯门区| 青川县| 任丘市| 客服| 常德市| 远安县| 湟中县| 涡阳县| 开阳县| 共和县| 莎车县| 科技| 固始县| 缙云县| 德令哈市| 铜梁县| 襄汾县| 成都市| 中阳县| 繁昌县| 高要市| 航空| 启东市| 安龙县| 驻马店市| 农安县| 禹城市| 乌恰县| 炉霍县| 偏关县| 荥经县| 开原市| 来凤县| 阜平县| 滨州市|