Skip to content

Instantly share code, notes, and snippets.

@bdjnk
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdjnk/9263006 to your computer and use it in GitHub Desktop.
Save bdjnk/9263006 to your computer and use it in GitHub Desktop.
Script to enable page looping of the current container in LLX
/* Works only for an odd number of pages, with the
* 'home' page centered.
* Requires snap to pages and an extra blank page
* on either side.
* @pages number of pages on either side of 'home'.
*/
var e = LL.getEvent();
var c = LL.getContainer();
var pos = c.getPositionX();
var width = c.getWidth();
var pages = 2;
var jump = 0;
var glide = 0;
if (pos >= width*pages) {
jump = 1 - width*pages;
glide = 1 - width;
}
if (pos <= -width*pages) {
jump = width*pages - 1;
glide = width + 1;
}
if (change != 0) {
c.setPosition(jump, 0, 1, false);
c.setPosition(glide, 0, 1, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment