博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mootools_使用MooTools或jQuery的iPhone单击效果
阅读量:2528 次
发布时间:2019-05-11

本文共 1489 字,大约阅读时间需要 4 分钟。

mootools

One thing I love about love about Safari on the iPhone is that Safari provides a darkened background effect when you click a link. It's the most subtle of details but just enforces than an action is taking place. So why not implement that on any page? We can easily do so using MooTools or jQuery.

我喜欢iPhone上的Safari,我喜欢的一件事是,当您单击链接时,Safari会提供深色的背景效果。 这是最微妙的细节,但只是执行而不是执行操作。 那么,为什么不在任何页面上实现呢? 我们可以使用MooTools或jQuery轻松地做到这一点。

CSS (The CSS)

.clicked { padding:1px 2px; -moz-border-radius:5px; background:#aaa; }

Style as you wish!

随心所欲!

MooTools JavaScript (The MooTools JavaScript)

window.addEvent('domready',function() {	var lynx = $$('a');	lynx.addEvent('click',function(e) {		lynx.removeClass('clicked'); //remove from others		this.addClass('clicked');	});});

The syntax between the two frameworks is very similar.

这两个框架之间的语法非常相似。

jQuery JavaScript (The jQuery JavaScript)

$(document).ready(function() {	var lynx = $('a');	lynx.click(function(e) {		lynx.removeClass('clicked');		$(this).addClass('clicked');	});});

My example shows the gray background but what's great is that since the snippet uses a CSS class, you can make the background any color you'd like. You could add a spinner next to the link or italicize the link text. Of course when a link is clicked there's only a moment where you can see the added effect but I think it's worth it!

我的示例显示了灰色背景,但最棒的是,由于该代码段使用CSS类,因此您可以将背景设置为任何所需的颜色。 您可以在链接旁边添加一个微调框,也可以将链接文本用斜体显示。 当然,当单击链接时,只有片刻可以看到增加的效果,但是我认为这是值得的!

翻译自:

mootools

转载地址:http://acpwd.baihongyu.com/

你可能感兴趣的文章
N皇后问题
查看>>
七大基本排序算法之冒泡排序
查看>>
java第七次作业
查看>>
破解思科路由器密码
查看>>
JVM介绍
查看>>
字符串的常用方法
查看>>
Docker: 快速搭建LNMP网站平台
查看>>
web开发之Servlet 二
查看>>
JAVA提高十:ArrayList 深入分析
查看>>
人工智能入门(六):SVM
查看>>
6.用CXF编写基于Spring的WebService
查看>>
Commands in Powershell
查看>>
bzoj2748 [HAOI2012]音量调节 背包
查看>>
【bzoj2301】[HAOI2011]Problem b 莫比乌斯反演
查看>>
STL
查看>>
浅谈SQL Server中的事务日志(三)----在简单恢复模式下日志的角色
查看>>
ArrayList 源码分析
查看>>
文本超出内容区域后用三个省略号代替
查看>>
不高兴的津津
查看>>
(转) exp1-3://一次有趣的XSS漏洞挖掘分析(3)最终篇
查看>>