Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "seamless" page transition option #64

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jasonbnewell
Copy link

I hacked out a version of this a few months ago and just took the time to build it into your widget properly. This has been tested with all original examples (even ajax) as well as my own version of the examples with the option enabled ("continuous" folder - removed in one of the last commits - you can check them out if you just load up the one before that).

I've tried to keep the code/example style as close to the original as possible. I've also made extra effort to reuse as much of the existing code as I could as well (I went from adding about 100 lines of code to simplifying the original enough that this new version is actually slightly shorter). The paginate function could probably be merged a bit more, but it's pretty close.

I built this feature into the existing code as deep as possible, and was able to avoid a major overhaul. This option works by looping over the elements and generating pages until a page that contains the last STEP elements is created (filled out with the beginning elements). I've added examples in the comments.

I've added an option that will stop page generation before elements begin repeating, along with an example. This is desirable in cases (especially if auto is enabled) where page selection controls are shown to the user instead of prev/next control.

I hope you have the time to review this and add it to this codebase. I've seen that this is a pretty commonly requested feature and I've spent some time ensuring that this addition doesn't break anything.

Thanks.

…: BOOL and honestPageCount: BOOL.

The Honest Page Count setting is disabled by default when seamless is enabled. This is to preserve familiar functionality in cases like the gotopage and lightbox examples. When honestPageCount is disabled, the USEFUL page count will be returned. The first set of pages before repeating elements is returned. This will cause some elements to be cut off in cases where visible % total elements != 0, but will allow consistent page transitions.
…eration before elements repeat. This is a desirable option in cases where page selection controls are used instead of prev/next.
@toshnota
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants