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

Add partial view of prev and next slide #1

Open
arcxyz opened this issue Mar 5, 2015 · 3 comments
Open

Add partial view of prev and next slide #1

arcxyz opened this issue Mar 5, 2015 · 3 comments

Comments

@arcxyz
Copy link

arcxyz commented Mar 5, 2015

For a lot of mobile projects I have a hardcoded version of swipe to make this. I've decided to fork your repo and add the "partial" option. Check it out:

Demo: http://arcxyz.github.io/swipe/
Code: https://github.com/arcxyz/swipe

It only works with 3+ slides and probably only with continuous option.

Partial option

@lyfeyaj
Copy link
Owner

lyfeyaj commented Mar 6, 2015

@arcxyz Nice Feature!
I create a PR from your repo, and will review it later. But there is a little bug: lets say there are 3 slides, starting at 1, when click next, 1 is moving faster than 2.

@arcxyz
Copy link
Author

arcxyz commented Mar 12, 2015

I made some changes to the slide function, could you check it now?

@morer
Copy link

morer commented Mar 3, 2016

@arcxyz Great Job
But I found that if I change the ratio of each slide, like this:
width = options.partial ? containerWidth*0.8 : containerWidth; element.style.width = (slides.length * width) + 'px'; partialPos = { hidden: containerWidth, prev: -containerWidth*0.7, middle: containerWidth*0.1, next: containerWidth*0.9 };

I clicked next and the next slide does not appear, and then I checked slide direction definition

var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward

and I change
if (options.partial) { if (direction === -1) {
to

if (options.partial) { if (natural_direction === -1) {
in function slide, the next slide shows up.

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

No branches or pull requests

3 participants