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

javascript+jQuery實(shí)現(xiàn)360開機(jī)時(shí)間顯示效果

 更新時(shí)間:2017年11月03日 17:13:43   作者:Dragonir  
這篇文章主要介紹了javascript+jQuery實(shí)現(xiàn)360開機(jī)時(shí)間顯示效果,在文中給大家提到了js實(shí)現(xiàn)時(shí)間倒計(jì)時(shí)的代碼,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下

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

實(shí)現(xiàn)原理:

  給關(guān)閉按鈕綁定點(diǎn)擊事件,點(diǎn)擊以后觸發(fā)動(dòng)畫效果。利用jQuery的animate方法,先讓顯示天氣的盒子高度變?yōu)?,接著讓整個(gè)包含天氣和事件的盒子寬度變?yōu)?,最后通過將display屬性值設(shè)為none,使得close按鈕消失。

實(shí)現(xiàn)代碼:

<!DOCTYPE html>
<html>
<head>
 <title>仿360開機(jī)效果</title>
 <meta charset="utf-8">
 <style type="text/css">
  *{
   padding: 0;
   margin: 0;
  }
  .box{
   width: 320px;
   position: fixed;
   bottom: 0;
   right: 0;
   box-shadow: 1px 1px 10px #2d2d2d;
  }
  #close{
   position: absolute;
   top: 0;
   right: 0;
   width: 30px;
   height: 20px;
   cursor: pointer;
   background-color: red;
   color: pink;
   font-weight: bold;
   text-align: center;
  }
  .hd{
   width: 320px;
   height: 300px;
   background-color: #03c03c;
   color: #fff;
   font-size: 70px;
   line-height: 300px;
   text-align: center;
  }
  .bd{
   width: 320px;
   height: 100px;
   background-color: #fffc00;
   font-size: 30px;
   line-height: 100px;
   text-align: center;
  }
 </style>
</head>
<body>
<div class="box">
 <span id="close">X</span>
 <div class="hd" id="t">1分12秒</div>
 <div class="bd" id="b">天氣:晴天</div>
</div>
<!-- 引入jQuery -->
<script type="text/javascript" src="./jquery1.0.0.1.js"></script>
<script type="text/javascript">
 window.onload = function(){
  var close = document.getElementById("close");
  var box = close.parentNode;
  var b = document.getElementById("b");
  // 給關(guān)閉按鈕綁定點(diǎn)擊事件
  close.onclick = function(){
   animate(b, {"height":0}, function(){
    animate(box,{"width":0});
   });
   close.style.display = "none";
  }
 }
</script>
</body>
</html>

PS:JS 實(shí)現(xiàn)時(shí)間倒計(jì)時(shí)

<script type="text/javascript">
var maxtime = 1350057600 //截止到的日期
var now=parseInt((new Date().getTime())/1000);//獲取當(dāng)前的日期
var cha_time=maxtime-now;//中間所差的時(shí)間

下面方法把相差的時(shí)間組合成倒計(jì)時(shí)的字符串,然后放到頁面相應(yīng)位置實(shí)現(xiàn),實(shí)時(shí)刷新

function CountDown(){ 
if(cha_time>=0){
var day = Math.floor(cha_time/3600/24);
var hour= Math.floor((cha_time/3600)%24);
var minutes = Math.floor((cha_time/60)%60); 
var seconds = Math.floor(cha_time%60); 
msg = "離結(jié)束還有"+day+"天"+hour+"小時(shí)"+minutes+"分"+seconds+"秒"; 
$(".ws_sg_con_big,.ws_sg_con_small").find("dd").html(msg);
--cha_time; 
} 
else{ 
clearInterval(timer); 
alert("時(shí)間到,結(jié)束!"); 
} 
} 
timer = setInterval("CountDown()",1000); 
</script>

總結(jié)

以上所述是小編給大家介紹的javascript+jQuery實(shí)現(xiàn)360開機(jī)時(shí)間顯示效果,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論