GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — iscroll5.doc.cn/snap.md at master · iiunknown/iscroll5.doc.cn

Expand file tree

/

snap.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (27 loc) · 1.19 KB
/

snap.md

Copy path

File metadata and controls

42 lines (27 loc) · 1.19 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

对齐

iScroll能对齐到固定的位置和元素。

options.snap

最简单的对齐配置如下:

var myScroll = new IScroll('#wrapper', {
    snap: true
});

这将按照页面容器的大小自动分割滚动条。

snap属性也可以传递字符类型类型的值。这个值是滚动条将要对齐到的元素的选择器。比如下面:

var myScroll = new IScroll('#wrapper', {
    snap: 'li'
});

这个示例中滚动条将会对齐到每一个LI标记的元素。

下面将帮助你快速浏览iScroll提供的关于对齐的一系列有趣的方法。

goToPage(x, y, time, easing)

x 和 y呈现你想滚动到横向轴或者纵向轴的页面数。如果你需要在单个唯独上使用滚动条,只需要为你不需要的轴向传递0值。

time属性是动画周期,easing属性是滚动到指定点使用的擦除功能类型。请参考高级功能中的option.bounceEasing。这两个属性都是可选项。

myScroll.goToPage(10, 0, 1000);

上面这个例子将在一秒内沿着横向滚动到第10页。

next()
prev()

滚动到当前位置的下一页或者前一页。

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.