国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學習啦 > 學習電腦 > 電腦硬件知識 > 鍵盤鼠標 > js實現(xiàn)鼠標拖拽翻頁效果

    js實現(xiàn)鼠標拖拽翻頁效果

    時間: 沈迪豪908 分享

    js實現(xiàn)鼠標拖拽翻頁效果

      學習前端的同學你們知道怎么實現(xiàn)js鼠標拖拽翻頁效果嗎?不知道的話跟著學習啦小編一起來學習了解js鼠標拖拽翻頁效果的方法。

      js鼠標拖拽翻頁效果的方法

      <html>

      <head>

      <title>blog</title>

      <meta http-equiv=content-type content="text/html; charset=gb2312">

      <style>

      body{

      border:0px;

      margin:0px;

      overflow:hidden;

      background-color:transparent;

      font-family:宋體;

      }

      .page{

      position:absolute;

      width:700px;

      border:1px solid #999;

      background-color:#000;

      left:425px;

      margin-left:-350px;

      cursor:default;

      z-index:0;

      }

      ul{

      height:320px;

      list-style:none;

      margin:40px 50px 0px;

      padding:0px;

      }

      li{

      width:100%;

      height:30px;

      line-height:30px;

      font-size:14px;

      text-align:left;

      border-bottom:1px dashed #999;

      }

      a{

      text-decoration:none;

      color:#999;

      }

      a:hover{

      font-weight:bold;

      }

      li span{

      float:right;

      color:#999;

      }

      .tip{

      display:block;

      width:100%;

      font-size:12px;

      color:#999;

      text-align:center;

      margin:10px 0px 20px;

      }

      </style>

      </head>

      <body onselectstart="return false;">

      <script>

      function id(obj){

      return document.getElementById(obj);

      }

      var page;

      var lm,mx;

      var md=false;

      var sh=0;

      var en=false;

      window.onload=function(){

      page=document.getElementsByTagName("div");

      if(page.length>0){

      page[0].style.zIndex=2;

      }

      for(i=0;i<page.length;i++){

      page[i].className="page";

      page[i].innerHTML+="<span class=tip>第 "+(i+1)+"/"+page.length+" 頁 提示:左右拖拽翻頁</span>";

      page[i].id="page"+i;

      page[i].i=i;

      page[i].onmousedown=function(e){

      if(!en){

      if(!e){e=e||window.event;}

      lm=this.offsetLeft;

      mx=(e.pageX)?e.pageX:e.x;

      this.style.cursor="w-resize";

      md=true;

      if(document.all){

      this.setCapture();

      }else{

      window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);

      }

      }

      }

      page[i].onmousemove=function(e){

      if(md){

      en=true;

      if(!e){e=e||window.event;}

      var ex=(e.pageX)?e.pageX:e.x;

      this.style.left=ex-(mx-lm)+350;

      if(this.offsetLeft<75){

      var cu=(this.i==0)?page.length-1:this.i-1;

      page[sh].style.zIndex=0;

      page[cu].style.zIndex=1;

      this.style.zIndex=2;

      sh=cu;

      }

      if(this.offsetLeft>75){

      var cu=(this.i==page.length-1)?0:this.i+1;

      page[sh].style.zIndex=0;

      page[cu].style.zIndex=1;

      this.style.zIndex=2;

      sh=cu;

      }

      }

      }

      page[i].onmouseup=function(){

      this.style.cursor="default";

      md=false;

      if(document.all){

      this.releaseCapture();

      }else{

      window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);

      }

      flyout(this);

      }

      }

      }

      function flyout(obj){

      if(obj.offsetLeft<75){

      if( (obj.offsetLeft + 350 - 20) > -275 ){

      obj.style.left=obj.offsetLeft + 350 - 20;

      window.setTimeout("flyout(id('"+obj.id+"'));",0);

      }else{

      obj.style.left=-275;

      obj.style.zIndex=0;

      flyin(id(obj.id));

      }

      }

      if(obj.offsetLeft>75){

      if( (obj.offsetLeft + 350 + 20) < 1125 ){

      obj.style.left=obj.offsetLeft + 350 + 20;

      window.setTimeout("flyout(id('"+obj.id+"'));",0);

      }else{

      obj.style.left=1125;

      obj.style.zIndex=0;

      flyin(id(obj.id));

      }

      }

      }

      function flyin(obj){

      if(obj.offsetLeft<75){

      if( (obj.offsetLeft + 350 + 20) < 425 ){

      obj.style.left=obj.offsetLeft + 350 + 20;

      window.setTimeout("flyin(id('"+obj.id+"'));",0);

      }else{

      obj.style.left=425;

      en=false;

      }

      }

      if(obj.offsetLeft>75){

      if( (obj.offsetLeft + 350 - 20) > 425 ){

      obj.style.left=obj.offsetLeft + 350 - 20;

      window.setTimeout("flyin(id('"+obj.id+"'));",0);

      }else{

      obj.style.left=425;

      en=false;

      }

      }

      }

      </script>

      <div>

      <ul>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>東方之珠</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>啊!停不住的愛人</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>寧靜溫泉</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>你的樣子</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>戀曲1980</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>戀曲1990</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>戀曲2000</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>亞細亞的孤兒</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>伴侶</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>童年</a></li>

      </ul>

      </div>

      <div>

      <ul>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>愛的箴言</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>愛人同志</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>思念</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>母親</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>是否</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>牧童</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>青春舞曲</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>蒲公英</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>未來的主人翁</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>如今才是唯一</a></li>

      </ul>

      </div>

      <div>

      <ul>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>暗戀</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>彈唱詞</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>飛車</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>東方之珠</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>滾滾紅塵</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>光陰的故事</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>之乎者也</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>現(xiàn)象七十二變</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>鄉(xiāng)愁四韻</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>穿過你的黑發(fā)我的手</a></li>

      </ul>

      </div>

      <div>

      <ul>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>大兵歌</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>歌</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>黃色面孔</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>臺北紅玫瑰</a></li>

      <li><span>2009-4-9 12:35</span><a href=http://www.oern.cn>我所不能了解的事</a></li>

      </ul>

      </div>

      </body>

      </html>

    js實現(xiàn)鼠標拖拽翻頁效果相關(guān)文章:

    1.怎么用js實現(xiàn)簡單鼠標跟隨效果

    2.怎么實現(xiàn)js跨瀏覽器獲取鼠標按鍵的值

    3.怎么用JS實現(xiàn)鼠標單擊與雙擊事件共存

    4.使用js實現(xiàn)鼠標點擊變色

    5.js實現(xiàn)鼠標移到圖片顯示文字

    6.怎么實現(xiàn)js統(tǒng)計鼠標點擊次數(shù)

    1998901