Skip to content

Commit

Permalink
Merge pull request #733 from meandmax/drewfranklin-master
Browse files Browse the repository at this point in the history
Little fixes & Merge PR from Drew Franklin
  • Loading branch information
meandmax authored Jun 3, 2018
2 parents 62b81e5 + 9694359 commit ced88f1
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ npm-debug.log

.AppleDouble/
.DS_Store
yarn-error.log
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*

!/package.json
!/README.md
!/dist/**/*
!/src/**/*
14 changes: 11 additions & 3 deletions dist/jquery.lory.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,17 @@ function lory(slider, opts) {

if (typeof nextIndex !== 'number') {
if (direction) {
nextIndex = index + slidesToScroll;
if (infinite && index + infinite * 2 !== slides.length) {
nextIndex = index + (infinite - index % infinite);
} else {
nextIndex = index + slidesToScroll;
}
} else {
nextIndex = index - slidesToScroll;
if (infinite && index % infinite !== 0) {
nextIndex = index - index % infinite;
} else {
nextIndex = index - slidesToScroll;
}
}
}

Expand Down Expand Up @@ -321,7 +329,7 @@ function lory(slider, opts) {
index = nextIndex;
}

if (infinite && (nextIndex === slides.length - infinite || nextIndex === 0)) {
if (infinite && (nextIndex === slides.length - infinite || nextIndex === slides.length - slides.length % infinite || nextIndex === 0)) {
if (direction) {
index = infinite;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.lory.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jquery.lory.min.js.map

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions dist/lory.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,17 @@ function lory(slider, opts) {

if (typeof nextIndex !== 'number') {
if (direction) {
nextIndex = index + slidesToScroll;
if (infinite && index + infinite * 2 !== slides.length) {
nextIndex = index + (infinite - index % infinite);
} else {
nextIndex = index + slidesToScroll;
}
} else {
nextIndex = index - slidesToScroll;
if (infinite && index % infinite !== 0) {
nextIndex = index - index % infinite;
} else {
nextIndex = index - slidesToScroll;
}
}
}

Expand Down Expand Up @@ -321,7 +329,7 @@ function lory(slider, opts) {
index = nextIndex;
}

if (infinite && (nextIndex === slides.length - infinite || nextIndex === 0)) {
if (infinite && (nextIndex === slides.length - infinite || nextIndex === slides.length - slides.length % infinite || nextIndex === 0)) {
if (direction) {
index = infinite;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/lory.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lory.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ <h2>Run tests</h2>

</code></pre></div>

<img class="testscreen" src="http://maximilian-heinz.de/test.png" />
<img class="testscreen" src="./static/tests.png" />
</section>

<section class="api">
Expand Down
15 changes: 12 additions & 3 deletions src/lory.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,17 @@ export function lory (slider, opts) {

if (typeof nextIndex !== 'number') {
if (direction) {
nextIndex = index + slidesToScroll;
if (infinite && index + (infinite * 2) !== slides.length) {
nextIndex = index + (infinite - index % infinite);
} else {
nextIndex = index + slidesToScroll;
}
} else {
nextIndex = index - slidesToScroll;
if (infinite && index % infinite !== 0) {
nextIndex = index - index % infinite;
} else {
nextIndex = index - slidesToScroll;
}
}
}

Expand Down Expand Up @@ -190,7 +198,8 @@ export function lory (slider, opts) {
index = nextIndex;
}

if (infinite && (nextIndex === slides.length - infinite || nextIndex === 0)) {
if (infinite && (nextIndex === slides.length - infinite ||
nextIndex === slides.length - slides.length % infinite || nextIndex === 0)) {
if (direction) {
index = infinite;
}
Expand Down
2 changes: 1 addition & 1 deletion static/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ tr {
}

section {
padding: 40px 0;
padding: 40px 0 0 0;
}

section:nth-child(odd) {
Expand Down

0 comments on commit ced88f1

Please sign in to comment.