mootools_MooTools手电筒效果

mootools

Another reason that I love Twitter so much is that I'm able to check out what fellow developers think is interesting. Chris Coyier posted about a flashlight effect he found built with jQuery. While I agree with Chris that it's a little corny, it is a neat effect so I ported it over to MooTools.

我非常喜欢Twitter的另一个原因是,我能够查看其他开发人员认为有趣的东西。 克里斯·科耶尔(Chris Coyier)发表了关于他发现使用jQuery构建的手电筒效果的文章 。 尽管我同意Chris的观点,但它确实很不错,因此我将其移植到MooTools。

意象 (The Imagery)

Flashlight

CSS (The CSS)


	body { background:#00022a url(flashlight.jpg) 50% 50% no-repeat; }

MooTools JavaScript (The MooTools JavaScript)


window.addEvent('domready',function() {
	$(document.body).addEvent('mousemove',function(e) {
		this.setStyle('background-position',[e.page.x - 250,e.page.y - 250]);
	});
});

What's really impressive about this effect is how little code is involved. While I wouldn't recommend this for a commercial website, it doesn't have some fun value.

这种效果真正令人印象深刻的是涉及的代码很少。 虽然我不建议在商业网站上使用它,但它没有任何有趣的价值。

翻译自: https://davidwalsh.name/mootools-flashlight

mootools

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值