前端小白的开发之路之 ————右侧悬浮二维码(笔记)

本文介绍了一种在JSP页面中实现鼠标悬浮时显示不同二维码的方法,通过使用JavaScript和CSS,可以动态地显示和隐藏公众平台、微信和个人支付二维码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

右侧鼠标悬浮显示二维码

 

jsp页面

<div onmouseleave="hideRqCode()">
    <div id="divPortalFixBar" class="btn-group-vertical fix-vrm-bar" style="position:fixed">
        <button  type="button" class="btn btn-default" onmouseover="showGZH('GZH')" ><!--onmouseover="showGZH()"  -->
            <span>公众<br>号</span>
        </button>
        <button  type="button" class="btn btn-default" onmouseover="showGZH('WX')">
            <span>微信</span>
        </button>
        <button  type="button" class="btn btn-default" onmouseover="showGZH('ZFB')">
            <span>支付<br>宝</span>
        </button>
    </div>
    <div class="btn-group-vertical fix-vrm-bar2" style="position:fixed">
    
        <!--onmouseover="showGZH()"  -->
            <img id="GZH"  hidden="true" title="微信公众号" style="position:absolute;width:160px" src="${host}/resources/image/weixin.jpg"/>        
            <img id="WX"  hidden="true" title="微信" style="position:absolute;width:160px" src="${host}/resources/image/weixin.jpg"/>
            <img id="ZFB" hidden="true" title="支付宝" style="position:absolute;width:160px" src="${host}/resources/image/weixin.jpg"/>
    </div>
</div>

css样式

.fix-vrm-bar {
    position: fixed;
    top: 350px;
    right: 10px;
    z-index: 999;
}
.fix-vrm-bar-up {
    position: fixed;

    z-index: 999;
}
.fix-vrm-bar button {
    height:54px;
    width:54px;
    font-size:15px;
}

.fix-vrm-bar2 {
    position: fixed;
    top: 350px;
    right: 226px;
    z-index: 999;
}

 

js代码

function showGZH(id){
    hideRqCode();    
    $("#"+id).show();
}
function hideRqCode(){
    $("#GZH").hide();
    $("#WX").hide();
    $("#ZFB").hide();
}

我再网上看到很多例子都是一个图就能实现的例子 ,

实际需求是这个是用户自己维护的图片不能固定

不知道哪位大神有更好的建议请回复一下。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值