jQuery 文本屏蔽
我正在尝试创建一个小片段,除非链接悬停在文本上,否则文本将被屏蔽。类似这样的:
<span class="mask">My Information</span>
<a href="#">View Info</a>
当页面加载时,页面显示如下:
<span class="masked">••••••••••••••</span>
<a href="#">View Info</a>
本质上,项目符号将占用与其替换的文本一样多的空间。然后,当用户单击“查看信息”链接时,掩码将恢复为信息。
<span class="mask">My Information</span>
<a href="#">View Info</a>
在一页上会有多个这样的实例。
有什么想法吗?我真的不知道从哪里开始..我正在考虑制作一堆密码字段,但认为它会变得混乱..
I'm trying to create a small snipped that would allow for text to be masked unless a link was hovered over it. Something like this:
<span class="mask">My Information</span>
<a href="#">View Info</a>
When the page loads, the page is displayed as follows:
<span class="masked">••••••••••••••</span>
<a href="#">View Info</a>
Essentially the bullets would take up as much space as the text that its replacing. Then when a user clicks the "View Info" link, the mask would revert back to the information.
<span class="mask">My Information</span>
<a href="#">View Info</a>
There will be multiple instances of this on one page.
Any ideas? I don't really know where to begin.. I was thinking about making a bunch of password fields but thought it would get messy..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我确信远非完美!
jsfiddle
far from perfect i'm sure!
jsfiddle
使用数据()。在加载时,您可以将每个 $('.mask') 的内容放入 data: 中
,然后您可以将一个函数绑定到鼠标单击,用文本替换星号。
Use data(). At load you can put the content of every $('.mask') in a data:
And then you can bind a function to the mouse click that replaces stars with text.
我知道这可能与问题“但这里是如何使用 jquery
HTML显示和隐藏密码”无关
I know this might not related to the question 'but here is how to show and hide password' using jquery
HTML