国产探花免费观看_亚洲丰满少妇自慰呻吟_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制作簡單的吞噬特效,希望大家喜歡。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 武冈市| 晋江市| 班戈县| 渭南市| 华阴市| 龙井市| 即墨市| 彰化市| 灌阳县| 太白县| 仪陇县| 来宾市| 福鼎市| 嘉定区| 灌云县| 绿春县| 茌平县| 突泉县| 澄迈县| 静宁县| 郓城县| 哈巴河县| 开鲁县| 蓬溪县| 沈阳市| 陆丰市| 阿城市| 宜宾市| 墨竹工卡县| 北碚区| 洪江市| 佛坪县| 洪江市| 同江市| 宁海县| 萍乡市| 南川市| 马尔康县| 图们市| 宝坻区| 固原市|