欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門(mén)教程網(wǎng)!

JavaScript

當(dāng)前位置:主頁(yè) > 網(wǎng)絡(luò)編程 > JavaScript >

js仿360開(kāi)機(jī)效果

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:JavaScript|點(diǎn)擊: 次

本文實(shí)例為大家分享了js仿360開(kāi)機(jī)效果的具體代碼,供大家參考,具體內(nèi)容如下

實(shí)現(xiàn)效果:

1.點(diǎn)擊關(guān)閉圖片按鈕先往下退出再往右退出

實(shí)現(xiàn)步驟:

1.封裝運(yùn)動(dòng)函數(shù)
2.給圖片上的關(guān)閉設(shè)置一個(gè)盒子
3.給關(guān)閉盒子注冊(cè)點(diǎn)擊事件點(diǎn)擊后
4.下面圖片高度為0,設(shè)置一個(gè)緩動(dòng)動(dòng)畫(huà)
5.上面圖片寬度為0,設(shè)置一個(gè)緩動(dòng)動(dòng)畫(huà)

緩動(dòng)動(dòng)畫(huà)代碼(帶回調(diào)函數(shù)):`

 function getStyle(obj,attr){ //兼容性寫(xiě)法獲得樣式
        if(window.getComputedStyle){ 
          return window.getComputedStyle(obj, null)[attr];
        }else{
          return obj.currentStyle[attr];
        }
      }
       function animate(obj, json, speed, callback){
        clearInterval(obj.timer);
        obj.timer = setInterval(function(){
          var flag = true;
          for(var attr in json){
          var current = parseInt(getStyle(obj,attr));
          var step = (json[attr] - current) / 10;
           step = step > 0 ? Math.ceil(step) : Math.floor(step);
           obj.style[attr] = current + step +'px';
          if(current != json[attr]){
            flag = false;
          }
        }
         if(flag){ 
          clearInterval(obj.timer);
          if(callback && typeof callback == 'function'){ //驗(yàn)證callback是否傳遞,傳遞的話看是否是函數(shù)類(lèi)型
           callback();
          }
         }
        },speed);
      }

開(kāi)機(jī)圖片,的由兩個(gè)圖片中組成

<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title></title>
  <style>
    .box{
      width: 322px;
      position: fixed;
      bottom:0;
      right:0;
    }
    span{
      position: absolute;
      top:0;
      right:0;
      width:30px;
      height: 20px;
      cursor: pointer;
    }
    .box img{
      vertical-align: top;
    }
  </style>
  <script type="text/javascript" src="函數(shù)封裝.js"></script>
  <script type="text/javascript">
    function $(id){
      return document.getElementById(id);
    }
    window.onload = function(){
      var span = document.getElementsByTagName('span')[0];
      var box = $('box');
      var bottom = $('bt');
      var top = $('hd');
      span.onclick = function(){
        var json = {"height": 0};
        animate(bottom,json,20,function(){
        animate(box,{"width":0},20);
        });
      }
    }
  </script>
</head>
<body>
<div class="box" id="box">
  <span></span>
  <div class="hd" id="hd">
    <img src="images/t.jpg" alt=""/>
  </div>
  <div class="bd" id="bt">
    <img src="images/b.jpg" alt=""/>
  </div>
</div>
</body>
</html>

效果:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持我們。

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有