使用js和jq无法切换display效果,但是用alert有获取到div的display
<li>
<botton class="social-custom" style="cursor:pointer;" onclick="openwechat()">
<img src="//cdn.shopify.com/s/files/1/0520/6396/1266/files/wechat.png?v=1675139232">
</botton>
</li>
<div id="wechatdiv" style="display:none;">
<botton style="cursor:pointer;" onclick="closewechat()"><img src="https://img.icons8.com/material-outlined/15/null/delete-sign.png"></botton>
<img src="//cdn.shopify.com/shopifycloud/shopify/assets/no-image-100-c91dd4bdb56513f2cbf4fc15436ca35e9d4ecd014546c8d421b1aece861dfecf_small.gif"></div>
<script>
function openwechat(){
var showWechat = document.getElementById("wechatdiv").style.display;
if (showWechat = "none") {
document.getElementById("wechatdiv").style.display = "block";
} else {
document.getElementById("wechatdiv").style.display = "none";
}
}
function closewechat(){
var showWechat = document.getElementById("wechatdiv").style.display;
if (showWechat = "block") {
document.getElementById("wechatdiv").style.display = "none";
}
}
</script>