当前位置: 首页 > 工具软件 > smoothscroll > 使用案例 >

mootools_使用MooTools 1.2的SmoothScroll

艾心远
2023-12-01

mootools

A while back I wrote a post about MooTools' SmoothScroll plugin which allows you to smoothly take a user to a specific portion of a page. By default, the browser "jerks" you up or down in the page when you click on an anchor -- SmoothScroll lets you define the duration that it should take for a link to be scrolled down to.

前一段时间, 我写了一篇关于MooTools的SmoothScroll插件的文章 ,它使您可以平稳地将用户带到页面的特定部分。 默认情况下,单击锚点时,浏览器会在页面中向上或向下“拉动”您-SmoothScroll允许您定义链接向下滚动所需要的持续时间。

MooTools 1.2 has a slightly different usage of the SmoothScroll plugin. In Moo 1.2, you instantiate the plugin as follows:

MooTools 1.2对SmoothScroll插件的使用略有不同。 在Moo 1.2中,您可以按以下方式实例化插件:

//when the dom is ready
window.addEvent('domready',function() {
	//smooooooth scrolling enabled
	//new SmoothScroll({ options }, window);
	new SmoothScroll({ duration:700 }, window); //700 milliseconds to get there
});

翻译自: https://davidwalsh.name/smooth-scroll-mootools

mootools

 类似资料: