欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS實(shí)現(xiàn)的新聞列表自動(dòng)滾動(dòng)效果示例

 更新時(shí)間:2019年01月30日 09:37:23   作者:waterDjj  
這篇文章主要介紹了JS實(shí)現(xiàn)的新聞列表自動(dòng)滾動(dòng)效果,涉及javascript基于時(shí)間函數(shù)的頁(yè)面元素屬性動(dòng)態(tài)變換相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了JS實(shí)現(xiàn)的新聞列表自動(dòng)滾動(dòng)效果。分享給大家供大家參考,具體如下:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style type="text/css">
    #box{width:260px;height:100px;margin:0 auto;border:2px solid red;overflow: hidden}
    ul{padding:0;margin:0;list-style: none;overflow: hidden}
    ul li{height:24px;line-height: 24px;padding-left:10px;}
    a{text-decoration: none;color:#000;}
    a:hover{color:#f00}
  </style>
</head>
<body>
<div id="box">
  <ul id="con1" onMouseOut="Up()" onMouseOver="Stop()">
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >1,課程html</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >2,課程css</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >3,課程js</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >4,課程jquery</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >5,課程html5</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >6,課程css3</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >7,課程hp</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >8,課程bpootstrap</a> </li>
    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >9,課程apicloud</a> </li>
  </ul>
  <ul id="con2"></ul>
</div>
</body>
<script type="text/javascript">
  var box=document.getElementById("box");
  var con1=document.getElementById("con1");
  var con2=document.getElementById("con2");
  var s=document.getElementsByTagName("a");
  var speed=50;
  con2.innerHTML=con1.innerHTML;
  function ScrollUp(){
    if( box.scrollTop>=con1.scrollHeight){
      box.scrollTop=0;
    }else
      box.scrollTop++;
  }
  var i=setInterval("ScrollUp()",speed);
  function Stop(){
    clearInterval(i);
  }
  function Up(){
    i=setInterval("ScrollUp()",speed);
  }
</script>
</html>

這里使用在線(xiàn)HTML/CSS/JavaScript代碼運(yùn)行工具http://tools.jb51.net/code/HtmlJsRun測(cè)試上述代碼,可得如下運(yùn)行效果:

更多關(guān)于JavaScript相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《JavaScript切換特效與技巧總結(jié)》、《JavaScript查找算法技巧總結(jié)》、《JavaScript錯(cuò)誤與調(diào)試技巧總結(jié)》、《JavaScript數(shù)據(jù)結(jié)構(gòu)與算法技巧總結(jié)》、《JavaScript遍歷算法與技巧總結(jié)》及《JavaScript數(shù)學(xué)運(yùn)算用法總結(jié)

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • KnockoutJs快速入門(mén)教程

    KnockoutJs快速入門(mén)教程

    這篇文章主要為大家分享了KnockoutJs快速入門(mén)教程,了解KnockoutJs到底是什么?如何使用KnockoutJS中的data-bind語(yǔ)法來(lái)將模型數(shù)據(jù)綁定到DOM元素中,感興趣的小伙伴們可以參考一下
    2016-05-05
  • countup.js實(shí)現(xiàn)數(shù)字動(dòng)態(tài)疊加效果

    countup.js實(shí)現(xiàn)數(shù)字動(dòng)態(tài)疊加效果

    這篇文章主要為大家詳細(xì)介紹了countup.js實(shí)現(xiàn)數(shù)字動(dòng)態(tài)疊加效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-10-10
  • JavaScript中的Truthy和Falsy介紹

    JavaScript中的Truthy和Falsy介紹

    這篇文章主要介紹了JavaScript中的Truthy和Falsy介紹,JavaScript中存在Truthy值和Falsy值的概念,本文講解了它的相關(guān)概念,需要的朋友可以參考下
    2015-01-01
  • 如何用JavaScipt測(cè)網(wǎng)速

    如何用JavaScipt測(cè)網(wǎng)速

    這篇文章主要介紹了如何用JavaScipt測(cè)網(wǎng)速,對(duì)測(cè)網(wǎng)速感興趣的同學(xué),可以參考下
    2021-05-05
  • layui在form表單頁(yè)面通過(guò)Validform加入簡(jiǎn)單驗(yàn)證的方法

    layui在form表單頁(yè)面通過(guò)Validform加入簡(jiǎn)單驗(yàn)證的方法

    今天小編就為大家分享一篇layui在form表單頁(yè)面通過(guò)Validform加入簡(jiǎn)單驗(yàn)證的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-09-09
  • 如何利用JS檢查元素是否在視口內(nèi)

    如何利用JS檢查元素是否在視口內(nèi)

    這篇文章主要給大家介紹了關(guān)于如何利用JS檢查元素是否在視口內(nèi)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-04-04
  • js拖動(dòng)div 當(dāng)鼠標(biāo)移動(dòng)時(shí)整個(gè)div也相應(yīng)的移動(dòng)

    js拖動(dòng)div 當(dāng)鼠標(biāo)移動(dòng)時(shí)整個(gè)div也相應(yīng)的移動(dòng)

    要拖動(dòng)的div為最外層的div,這段代碼對(duì)顯示對(duì)話(huà)框的頭部綁定鼠標(biāo)監(jiān)聽(tīng)事件,當(dāng)鼠標(biāo)移動(dòng)時(shí),整個(gè)div也相應(yīng)的移動(dòng),具體的實(shí)現(xiàn)如下,感興趣的朋友可以參考下
    2013-11-11
  • webpack實(shí)現(xiàn)靜態(tài)資源緩存的方法

    webpack實(shí)現(xiàn)靜態(tài)資源緩存的方法

    本文主要介紹了webpack實(shí)現(xiàn)靜態(tài)資源緩存的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-08-08
  • 詳解iframe跨域的幾種常用方法(小結(jié))

    詳解iframe跨域的幾種常用方法(小結(jié))

    這篇文章主要介紹了詳解iframe跨域的幾種常用方法(小結(jié)),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2019-04-04
  • uniapp介紹與使用以及小程序?qū)崟r(shí)獲取視頻播放時(shí)間

    uniapp介紹與使用以及小程序?qū)崟r(shí)獲取視頻播放時(shí)間

    這篇文章主要給大家介紹了關(guān)于uniapp介紹與使用以及小程序?qū)崟r(shí)獲取視頻播放時(shí)間的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用uniapp具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2023-02-02

最新評(píng)論