Jquery+javascript实现支付网页数字键盘
(编辑:jimmy 日期: 2024/12/23 浏览:3 次 )
Jquery+javascript动态生成支付网页数字键盘
制作网页支付界面的时候,数字键盘适配不同的屏幕宽高比是一个很麻烦的事,所以我制作了一个根据屏幕宽高动态生成的数字键盘
运行截图:
实现代码
html:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta content="telephone=no" name="format-detection"> <meta content="email=no" name="format-detection"> <link rel="stylesheet" href="{{你的css文件路径}}" > <title>动态数字键盘</title> </head> <body> <div class="pay-top"> <img class="lklogo" src="/UploadFiles/2021-04-02/lianke.png">css
@CHARSET "UTF-8"; html,body{ background-color:#fff; } .pay-top{ position: absolute; width: 100%; height:60%; background: #fff; } .pay-shop-info { position: absolute; width: 90%; left:5%; text-align: right; top:3.4rem; font-size:0.3rem ; } .paymoneylogo { position: absolute; width: 90%; left:5%; top:4rem; height: 1.3rem; border-bottom: 0.02rem solid #bfbfbf; -webkit-border-radius: 0.02rem; -moz-border-radius: 0.02rem; border-radius: 0.02rem; background: #fff; } .inputlabel{ position: absolute; width: 90%; left:5%; top:4rem; height: 1.3rem; text-align: right; } .lklogo{ position: absolute; height: 1.2rem; width: 50%; left:25%; top:0.8rem; } .payinfo{ display:none; } .payinfo .paynum { font-size: 0.6rem; color: #424857; } .payinfo .payzero { font-size: 0.6rem; color: #424857; } table{ width:100%; height:50%; position:absolute; bottom:0; background-color:white; background-top:none; } table tr td{ text-align:center; width: 1.88rem; height: 1.26rem; font-family: "Microsoft YaHei"; font-weight: normal; border-right:1px solid #D9D9D9; border-top:1px solid #D9D9D9; } table tr td:active{ background-color:#ECECEC; } .keybord-return{ width: 1.88rem; height: 1.26rem; background:url(../img/keybord_return.png) no-repeat; background-size: 50% 50%; background-position: center; } .pay{ color:#fff; font-size:0.4rem; background-color:#0259a1; } .pay:active{ background-color: #004198; } .pay a{ display: block; position: relative; width: 100%; height: 100%; color: #fff; text-decoration: none; } .a-pay { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .pay-disabled { background-color: #0259a1; }附带上退格符,将其放项目的img文件中,否则数字键盘退格符无法显示:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
下一篇:微信小程序实现modal弹出框遮罩层组件(可带文本框)