博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mootools_流体锚–使用MooTools的平滑锚
阅读量:2523 次
发布时间:2019-05-11

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

mootools

While we as programmers get more used to using AJAX and advanced JavaScript frameworks, we can only assume that our users will. At one time, it was acceptable to have elements dynamically just "pop into" the screen but now we must strive to make the experience smoother for our users. That's why MooTools has put a big focus on the "Fx" part of their framework.

当我们作为程序员逐渐习惯于使用AJAX和高级JavaScript框架时,我们只能假设用户会这样做。 一次可以动态地将元素“弹出”屏幕是可以接受的,但是现在我们必须努力为用户提供更流畅的体验。 因此,MooTools一直将重点放在其框架的“ Fx”部分。

Page anchors are great. Page anchors allow us to link within the same page and this is especially useful for long pages where we can use a "top" anchor to move to the top of the page, saving the user miles of scrolling. The only problem with this functionality is that it is extremely jumpy; the user could click the anchor and be placed to the anchor point before they know what hit them. Not smooth.

页面锚点很棒。 页面锚点允许我们在同一页面内链接,这对于长页面尤其有用,在长页面上,我们可以使用“顶部”锚点移动到页面顶部,从而节省了用户的滚动距离。 此功能的唯一问题是它的跳动非常Swift; 用户可以单击锚点并将其放置到锚点上,然后再知道受到了什么打击。 不光滑。

MooTools provides an easy, customizable plugin to fix the chaos of anchors.

MooTools提供了一个简单,可自定义的插件来解决锚点混乱的问题。

文件 (The Files)

(~19kb)

(〜19kb)

代码 (The Code)

window.addEvent('domready',function() { new SmoothScroll({ duration: 1800 }); });

用法 (The Usage)

The only adjustment to your anchors is that you will need to add an id attribute to the anchor that mimics the same value as the name element.

对锚点的唯一调整是,您将需要向锚点添加一个id属性,该属性模仿与name元素相同的值。

Sugar!

You'll not that the option I've used about is the duration option, which essentially sets the duration of the scroll. SmoothScroll calculates the amount of space on the page between the anchor link and the anchor and speeds the scroll automatically so that all scrolls take the 'duration' time to complete.

您不会发现我使用过的选项是duration选项,它实际上设置了滚动的持续时间。 SmoothScroll计算锚链接和锚之间页面上的空间量,并自动加快滚动速度,以便所有滚动都花费“持续时间”来完成。

Another unobtrusive usage of the to improve the functionality of your pages.

另一种用法,可以改善页面的功能。

翻译自:

mootools

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

你可能感兴趣的文章
团队编程项目作业2-团队编程项目代码设计规范
查看>>
英特尔公司将停止910GL、915GL和915PL芯片组的生产
查看>>
团队编程项目作业2-团队编程项目开发环境搭建过程
查看>>
Stax解析XML示例代码
查看>>
cookie
查看>>
二级图片导航菜单
查看>>
<Using parquet with impala>
查看>>
07-Java 中的IO操作
查看>>
uclibc,eglibc,glibc之间的区别和联系【转】
查看>>
Java魔法堂:找外援的利器——Runtime.exec详解
查看>>
mysql数据库存放路径
查看>>
TestNG(五)常用元素的操作
查看>>
解决 Visual Studio 点击添加引用无反应的问题
查看>>
通过镜像下载Android系统源码
查看>>
python字符串格式化 %操作符 {}操作符---总结
查看>>
windows 不能在 本地计算机 启动 Apache
查看>>
iOS开发报duplicate symbols for architecture x86_64错误的问题
查看>>
Chap-6 6.4.2 堆和栈
查看>>
【Java学习笔记之九】java二维数组及其多维数组的内存应用拓展延伸
查看>>
C# MySql 连接
查看>>