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

javascript實(shí)現(xiàn)右下角廣告框效果

 更新時(shí)間:2017年02月01日 10:15:41   作者:Jack-小俊  
這篇文章主要為大家詳細(xì)介紹了javascript實(shí)現(xiàn)右下角廣告框效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文教大家用原生js實(shí)現(xiàn)的簡(jiǎn)單網(wǎng)頁(yè)主頁(yè)右下角的廣告框效果,利用好絕對(duì)定位,點(diǎn)擊X關(guān)閉廣告,里面的內(nèi)容不管動(dòng)圖或者視頻都可以。

代碼最簡(jiǎn)潔,js行為優(yōu)化版,復(fù)制粘貼即可使用。 

演示部分

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>右下角廣告框效果</title>
</head>
<style type="text/css">
  #advbox{
    width: 400px;
    height: 300px;
    position: fixed;
    right: 0;
    bottom: 0;
  }
  .adv{
    width: 380px;
    height: 270px;
    border: 1px solid #a00;
    position: relative;
  }
  #icon{
    display: block;
    width: 24px;
    height: 24px;
    color: #0c0;
    font-size: 30px;
    font-weight: bolder;
    position: absolute;
    right: 2px;
    top: 2px;
    cursor: pointer;
  }
  #resetadv{
    width: 105px;
    height:20px;
    position: fixed;
    right: 25px;
    bottom: 15px;
    color: #fff;
    font-size: 20px;
    background-color: #333;
  }
  .hide{
    display: none;
  }
  .show{
    display: block;
  }
</style>
<body>
  <div id="advbox">
    <div class="adv">
    <img src="" alt="結(jié)合html5,這可以是一個(gè)gif,swf或者video">
    <span id="icon">X</span>
    </div>
  </div>
  <div id="resetadv">廣告入口>></div>

<script type="text/javascript">
  (function(){
      //封裝一下dom的id操作
      var $ = function(id){
        return document.getElementById(id);
      };
      //添加點(diǎn)擊事件
      $("icon").onclick=function(){
        $("advbox").className = "hide";
      };
      $("resetadv").onmouseover=function(){
        $("advbox").className = "show";
      };
  })();
</script>  
</body>
</html>

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

相關(guān)文章

最新評(píng)論