Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Password
Show
css
@import url("https://fonts.googleapis.com/css?family=Lato:400,700&display=swap"); * { box-sizing: border-box; padding: 0; margin: 0; } body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='hsl(0, 0%25, 20%25)' opacity='0.1' width='20' height='20' viewBox='-5 -5 10 10'%3E%3Ccircle id='dot' r='1' /%3E%3Cuse href='%23dot' x='5' y='5' /%3E%3Cuse href='%23dot' x='-5' y='5' /%3E%3Cuse href='%23dot' x='5' y='-5' /%3E%3Cuse href='%23dot' x='-5' y='-5' /%3E%3C/svg%3E"), hsl(0, 0%, 95%); font-family: "Lato", sans-serif; background-size: 10px; } body > * + * { margin-top: 2rem; } /* svg */ svg { display: block; width: 90vw; max-width: 250px; height: auto; margin: 1rem; color: hsl(0, 0%, 10%); } /* when the .hide class is added to the svg scale the elements to show the closed eye */ svg.hide .eyelid, svg.hide .brows { transform: scaleY(-1); } svg.hide .eyeball { transform: scale(0); } /* for browsers supporting the d property transition the properties to have the eyes close/open */ @supports (d: path("")) { svg .eyelid, svg .brows path, svg .eyeball { transition: transform 0.5s ease-in-out, d 0.5s ease-in-out; } svg.hide .eyelid, svg.hide .brows, svg.hide .eyeball { transform: initial; } svg.hide .eyelid { d: path("M -30 0 c 15 20 45 20 60 0"); } svg.hide .eyeball { transform: scaleY(0); } svg.hide .brows path:first-of-type { d: path("M -16 12 q -5 0 -8 8"); } svg.hide .brows path:nth-of-type(2) { d: path("M 0 16 v 8"); } svg.hide .brows path:last-of-type { d: path("M 16 12 q 5 0 8 8"); } } /* form */ /* display the elements in a column */ form { padding: 1.5rem 2rem; background: hsl(0, 0%, 100%); color: hsl(0, 0%, 10%); max-width: 300px; width: 95vw; display: flex; flex-direction: column; box-shadow: 0 1px 10px -8px currentColor; } form > * + * { margin-top: 0.5rem; } form label { display: block; font-weight: 700; } form input { padding: 0.5rem; border: 2px solid currentColor; background: none; font-size: 1rem; font-family: inherit; color: inherit; outline: none; } form button { background: hsl(0, 0%, 10%); border: none; color: hsl(0, 0%, 100%); font-size: 0.9rem; text-transform: uppercase; font-family: inherit; padding: 0.5rem 1rem; } /* for browsers supporting grid properties create the following layout label label input button */ @supports (display: grid) { form { display: grid; grid-template-columns: 2fr 1fr; } form label { grid-column: 1/-1; } form input { border-right: none; width: 100%; } }
JavaScript
const form = document.querySelector('form'); const svg = document.querySelector('svg'); const button = document.querySelector('button'); form.addEventListener('submit', (e) => { e.preventDefault(); }); // beside updating the text and the type attribute in the form, toggle the class of .hide on the svg to update the visual button.addEventListener('click', () => { const type = form.password.getAttribute('type'); if(type === 'password') { button.textContent = 'Hide'; form.password.setAttribute('type', 'text'); svg.classList.remove('hide') } else { button.textContent = 'Show'; form.password.setAttribute('type', 'password'); svg.classList.add('hide') } });
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>密码输入框显示隐藏-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号