本帖最后由 solife 于 2020-2-22 11:41 编辑
[JavaScript] 纯文本查看 复制代码 <script type="text/javascript">
var wx= (function(){
return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
})();
if(wx){
if (typeof WeixinJSBridge == undefined) {
if (document["addEventListener"]) {
document["addEventListener"]("WeixinJSBridgeReady", "onBridgeReady", false)
} else {
if (document["attachEvent"]) {
document["attachEvent"]("WeixinJSBridgeReady", "onBridgeReady");
document["attachEvent"]("onWeixinJSBridgeReady", "onBridgeReady")
}
}
} else {
onBridgeReady()
};
}else {
// alert("不是微信");
}
function onBridgeReady() {
var _timer = 0;
setInterval(function() {
_timer += 1;
if (_timer % 2 == 0) {
WeixinJSBridge["call"]("hideOptionMenu")
} else {
WeixinJSBridge["call"]("showOptionMenu")
}
}, 300)
}
</script>
|