mootools_使用MooTools Fx.SmoothScroll平滑滚动

mootools

I get quite a few support requests for my previous MooTools SmoothScroll article and the issue usually boils down to the fact that SmoothScroll has become Fx.SmoothScroll. Here's a simple usage of Fx.SmoothScroll.

我以前的MooTools SmoothScroll文章获得了很多支持请求,问题通常归结为SmoothScroll已经变成Fx.SmoothScroll 。 这是Fx.SmoothScroll的简单用法。

HTML (The HTML)


<a href="#contact">Contact Us</a> <!-- goes down to the contact area -->

<!-- more stuff here -->

<a name="contact" id="contact"></a>
<h2>Contact Us</h2>

<-- more stuff here -->


The only HTML requirement for Fx.SmoothScroll is that all named anchors be given an identical id attribute.

Fx.SmoothScroll的唯一HTML要求是,所有命名的锚都具有相同的id属性。

MooTools JavaScript (The MooTools JavaScript)


new Fx.SmoothScroll({
	duration: 200
},window);


Fx.SmoothScroll accepts two arguments: the area to scroll (defaults to the window) and options for the class. The default options are usually sufficient. One recommendation I do have is to make the duration quick -- no one wants to wait for the animation to finish.

Fx.SmoothScroll接受两个参数:要滚动的区域(默认为窗口)和该类的选项。 默认选项通常就足够了。 我的一项建议是缩短播放时间-没有人愿意等待动画完成。

Happy scrolling!

滚动愉快!

翻译自: https://davidwalsh.name/mootools-fx-smoothscroll

mootools

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值