javascript - Determine whether it is a WeChat browser. The same code will invalidate and take effect?
習慣沉默
習慣沉默 2017-05-19 10:38:22
0
2
670

Test address one: (test successful)
http://bbs2.valueonline.cn/we...

Test address two: (test failed)
http://bbs2.valueonline.cn/we...

Determine whether it is the code of WeChat browser:

<script type="text/javascript">
$(function(){
    //判断是否是微信
    var is_weixn=( function(){
        var ua = navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i)=="micromessenger"){
            return true;
        }
        else{
            $(".header").removeClass("hide");
            $(".footerMeumBox").hide();
            return false;
        }
    })()
})
</script>

The effect you want to achieve: (the head navigation will not be displayed in the WeChat browser, and the bottom navigation will not be displayed in the ordinary browser)

習慣沉默
習慣沉默

reply all(2)
为情所困

**Are you sure it is the same code?
Put one code in $(function(){})里,一份不放,当然不放的那一份,在执行的时候找不到$(".footerMeumBox")**

过去多啦不再A梦

Come to install the package. . liveStyle installation package, 2860342721@qq.com,,O(∩_∩)OThank you~(≧▽≦)/~ La La La.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template