代码分享h5-sessionStorage,提示app下载代码块

1.html:

  <div class="down-app">
    <span id="dowm-close">x</span>
    <dl>
      <dt>logo</dt>
      <dd>
        <h3>某某公司</h3>
        <p>某某公司宗旨</p>
      </dd>
    </dl>
    <div class="down-app-main clearfix"><a href="#">某某公司</a></div>
  </div>
  <div class="down-app-bg"></div>







2.css:  

.down-app-bg{position:fixed!important;bottom:-1px!important;100%;max-640px;min-320px;height:80px;z-index:1;display:none}
.down-app{position:fixed!important;bottom:0!important;100%;max-640px;min-320px;height:80px;z-index:2;direction:down;background:rgba(0,0,0,.71)}
.down-app span{display:inline-block;height:100%;10%;padding-left:2%;float:left}
.down-app dl{margin-top:.8%;height:100%;float:left}
.down-app dl dt{margin-right:10px;50px;height:100%;float:left}
.down-app dl dd{float:left}
.down-app dl dd h3{margin-top:10%;line-height:30px;font-size:18px;color:#FFF}
.down-app dl dd p{color:#fff;font-size:12px}
.down-app-main{text-align:right;height:100%;float:left;35%;position:relative}
.down-app-main a{position:absolute;right:0;90px;height:40px;text-align:center;line-height:40px;background:#f8b62b;display:inline-block;color:#fff;border-radius:5px;margin-top:15%}


3.js:

<script src="js/zepto.min.js"></script>
<script>
  $(function(){
    var downapp=$(".down-app,.down-app-bg");
    downapp[sessionStorage.getItem('downloadAPP') || 'show']();
    $("#dowm-close").on("click",function(){
    downapp.remove();
    sessionStorage.setItem('downloadAPP', 'remove');
  });

  //获取input时,app下载代码块隐藏
  var zm_input=$('#zm-user-reg-form-c input');
  zm_input.on('focus',function(){
    if ( $('.down-app').length){
      downapp.hide();
    }
  }).on('blur',function(){
    if ( $('.down-app').length){
      downapp.show();
    }
  });
})
</script>

原文地址:https://www.cnblogs.com/fcan/p/4819497.html