鼠标滑过显示隐藏二维码div方法分享

今天给客户做东西的时候,说要增加一个鼠标移过图标显示客服二维码的功能。刚开始准备用css的hover属性来做,后来发现局限性太大,就尝试用js来辅助制作了。

下面贴出代码,需要的朋友复制粘贴去吧!

CSS部分代码

<style>
.wxl {float:right;line-height:50px; margin-right:20px;} 
.wxl img{width:30px; }   
.wxewm img {width: 120px;position: fixed;right: 380px;margin-top: 60px;z-index: 9999;}  
</style>


JS部分代码      


<script>
onload=function(){
 b.style.display="none";
 a.onmouseenter=function(){
 b.style.display="block";
};
a.onmouseleave = function(){
 b.style.display="none";
 };
 };
</script>


HTML部分代码


<div class="wxl" id="a">

<a href="/" class="index-logo"><img src="/wxl.png"></a> //这里放你鼠标滑过的图标或者按钮

<div class="wxewm" id="b"><img src="/wxewm.png"></div> //这里放你鼠标移动过后需要显示的二维码图片 

</div>



如果内容有帮助,就点个赞吧!

转载注明出处:http://www.12564.cn/show-15.html

如有疑问请联系 QQ:644233191   微信:zw1688k