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

首頁 > 語言 > JavaScript > 正文

JS實現可用滑塊滑動的緩動圖代碼

2024-05-06 15:35:11
字體:
來源:轉載
供稿:網友

嘗試模仿京東的“發現好貨”模塊的可用滑塊滑動的緩動圖

JS代碼

function $(id) { return document.getElementById(id); }//緩動輪播圖var fhTimer;var fhNum = 0;var barNum = 0;fhTimer = setInterval(marquee, 20);function marquee() {  fhNum--;  barNum = fhNum;  if(fhNum < -2400) {    fhNum = 0;  }  $("fhc_ul").style.left = fhNum + "px";  if(fhNum < -2400) {    barNum = fhNum + 2400;  }  $("fhc_dBar").style.left = -(barNum / 2.75) + "px";}$("fhcShow").onmouseover = function() {  $("fhc_d_box").style.display = "block";  clearInterval(fhTimer);}$("fhc_d_box").onmouseover = function() {  $("fhc_d_box").style.display = "block";}$("fhcShow").onmouseout = function() {  $("fhc_d_box").style.display = "none";  fhTimer = setInterval(marquee, 20);}//鼠標懸浮在標題也在暫停滾動$("fhTit").onmouseover = function() {  clearInterval(fhTimer);}$("fhTit").onmouseout = function() {  fhTimer = setInterval(marquee, 20);}//滑塊$("fhc_dBar").onmousedown = function(event) {  var event = event || window.event;  var leftValue = event.clientX - this.offsetLeft;  document.onmousemove = function(event) {    var evt = event || window.event;    var locationX = evt.clientX - leftValue;    if(locationX < 0) {      locationX = 0;    }    else if(locationX > 960 - 99) {      locationX = 960 - 99;    }    $("fhc_dBar").style.left = locationX + "px";    fhNum = -locationX * 2.75;    //如果選中了,就取消選中,防止出現bug    window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();  }  document.onmouseup = function() {    document.onmousemove = null;//取消注冊的這個事件  }}

HTML代碼

<div class="fxhh_ctt">  <div class="fh_c_show" id="fhcShow">    <ul class="fh_c_under" id="fhc_ul">      <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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品1</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品2</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品3</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品4</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品5</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品6</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品7</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品8</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品9</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品10</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品11</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品12</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品1</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品2</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品3</p>        <img src="" alt="">      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <img src="" alt="">        <p class="botTit">商品4</p>      </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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >        <p class="topTit">商品5</p>        <img src="" alt="">      </a></li>    </ul>  </div>  <!-- 滑塊 -->  <div class="fhc_box" id="fhc_d_box">    <div class="fhc_drop" id="fhc_dBar"></div>  </div>  <!-- 滑塊end --></div>CSS代碼.fxhh .fxhh_ctt {  width: 990px;  background-color: #fff;  float: left;}.fxhh .fxhh_ctt .fh_c_show .fh_c_under img {  width: 150px;  height: 150px;}.fxhh .fxhh_ctt .fh_c_show {  width: 990px;  height: 260px;  background-color: #fff;  overflow: hidden;  position: relative;}.fxhh .fxhh_ctt .fh_c_show .fh_c_under {  width: 2000%;  position: absolute;}.fxhh .fxhh_ctt .fh_c_show .fh_c_under li {  float: left;  text-align: center;  width: 150px;  height: 180px;  margin-top: 40px;  margin-right: 50px;}.fxhh .fxhh_ctt .fh_c_show .fh_c_under li .topTit {  margin-bottom: 10px;}.fxhh .fxhh_ctt .fh_c_show .fh_c_under li .botTit {  margin-top: 10px;}.fxhh .fxhh_ctt .fhc_box {  display: none;  width: 960px;  height: 4px;  background-color: #f3f3f3;  margin: 0 auto;  position: absolute;  top: 250px;  left: 210px;}.fxhh .fxhh_ctt .fhc_drop {  width: 99px;  height: 9px;  border-radius: 4px;  background-color: #d8d8d8;  position: absolute;  top: -3px;}            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 新源县| 精河县| 济南市| 临湘市| 丹寨县| 安福县| 深水埗区| 霍城县| 延津县| 涿州市| 临海市| 璧山县| 白朗县| 卓资县| 桐乡市| 玛多县| 迭部县| 辉县市| 林口县| 墨玉县| 中超| 英吉沙县| 泸西县| 德阳市| 嘉善县| 崇阳县| 大同市| 通河县| 武冈市| 罗田县| 特克斯县| 宝兴县| 福泉市| 文山县| 塘沽区| 根河市| 巴南区| 应用必备| 墨江| 浦城县| 门源|