本站即日起正式部署SSL证书启用https安全连接, 联系站长:416326801#qq.com(#改成@)

微信html弹出点击右上角分享到朋友圈

标签: HTML Weixin

html

<a href="javascript:;" onclick="document.getElementById('mcover').style.display='block';">分享到朋友圈</a>

<div id="mcover" onclick="document.getElementById('mcover').style.display='';" style="display: none;">
     <img src="/public/images/guide.png">
</div>

guide.png

js

#mcover {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 20000;
}
#mcover img {
    position: fixed;
    right: 18px;
    top: 5px;
    width: 260px;
    height: 180px;
    z-index: 999;
}

鼠标移上去出现显示层

标签: HTML CSS

<div class="a">
    <img src="a.jpg" />
    <div class="b" >
        这里是图片的名字
    </div>
</div>
<style>
.a{width:100px; height:100px; position:relative;}
.b{width:100px; height:20px; background:#CCC url(/bg.png); position:absolute;left:0px; bottom:20px;display:none}
 
</style>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
    $(".a").hover(function(){
    $(this).find(".b").slideDown();
    },function(){
    $(this).find(".b").slideUp();
    });
});
</script>

阅读全文>>

判断是否微信浏览器(微信客户端)

标签: PHP JavaScript HTML Weixin

PHP

function is_weixin() {
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
        return true;
    }
    return false;
}


JavaScript

function is_weixin() {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
        return true;
    } else {
        return false;
    }
}


HTML

<script type="text/javascript">
          var ua = navigator.userAgent.toLowerCase();
          var isWeixin = ua.indexOf('micromessenger') != -1;
          var isAndroid = ua.indexOf('android') != -1;
          var isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1);
          if (!isWeixin) {
              document.head.innerHTML = '<title>抱歉,出错了</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"><link rel="stylesheet" type="text/css" >';
              document.body.innerHTML = '<div class="page_msg"><div class="inner"><span class="msg_icon_wrp"><i class="icon80_smile"></i></span><div class="msg_content"><h4>请在微信客户端打开链接</h4></div></div></div>';
          }
</script>