Last active
August 29, 2015 13:56
-
-
Save bdjnk/9263006 to your computer and use it in GitHub Desktop.
Script to enable page looping of the current container in LLX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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