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

微信提示 在瀏覽器打開(kāi) 效果實(shí)現(xiàn)過(guò)程解析

 更新時(shí)間:2019年09月10日 15:22:53   作者:山貓大戰(zhàn)響尾蛇  
這篇文章主要介紹了微信提示 在瀏覽器打開(kāi) 效果實(shí)現(xiàn)過(guò)程解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下

概述

大體思路是這樣的:先建一個(gè)蒙版,蒙版放上提示的信息,然后寫一個(gè)js,在頁(yè)面打開(kāi)的時(shí)候判斷是不是用微信自帶的瀏覽器打開(kāi)的,如果是就打開(kāi)蒙版,提示用瀏覽器打開(kāi)

.基本頁(yè)面

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>APP下載</title>
    <style type="text/css">
      td {
        line-height: 50px;
        font-size: 40px;
      }    
    </style>
  </head>
  <body style="background-color: #4DFFFF;padding-top: 400px">
    <div align="center" style="width: 100%;">
      <table>
        <tr>
          <td valign="middle">
            <a href="community.apk" rel="external nofollow" id="JdownApp">安卓下載</a>
          </td>
        </tr>
        <tr>
          <td valign="middle">
            <a href="community.ipa" rel="external nofollow" id="JdownApp2" class="btn-warn">蘋果下載</a>
          </td>
        </tr>
      </table>     
    </div>
  </body>
</html>

添加蒙版

<!--引入遮蔽層-->
<div id="Mask" style="">
</div>
//蒙版樣式
#Mask {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  background-image: url(img/tweixinip.jpg);
  background-size: cover;
  width: 100%;
  height: 100%;
  z-index: 1000;
}
.model-content {
  width: 100%;
  height: 100%;
  text-align: center;
  background: #ffffff;
  border-radius: 6px;
  margin: 100px auto;
  line-height: 30px;
  z-index: 10001;
}

添加js

<script type="text/javascript">
  //判斷是否在微信中打開(kāi)
  var ua = navigator.userAgent;
  var isWeixin = !!/MicroMessenger/i.test(ua);
  //如果使用的是微信自帶瀏覽器,就打開(kāi)蒙版
  if(isWeixin) {
    var SHOW = 0;
    document.getElementById('Mask').style.display = ++SHOW % 2 == 1 ? 'block' : 'none';
  }
</script>

最終效果

當(dāng)使用瀏覽器打開(kāi)時(shí)展示原始頁(yè)面

當(dāng)使用微信打開(kāi)時(shí)展示蒙版

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

相關(guān)文章

最新評(píng)論