Skip to content

Commit

Permalink
fix onControlsClick, checkIndex for gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
ganlanyuan committed Oct 24, 2017
1 parent b4d4926 commit 1e94968
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dist/min/tiny-slider.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sourcemaps/tiny-slider.js.map

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions dist/tiny-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1542,11 +1542,7 @@ var tns = function(options) {
var checkIndex = (function () {
if (loop) {
return function () {
var leftEdge = indexMin, rightEdge = indexMax;
if (carousel) {
leftEdge += slideBy;
rightEdge -= slideBy;
}
var leftEdge = indexMin + slideBy, rightEdge = indexMax - slideBy;

var gt = gutter ? gutter : 0;
if (fixedWidth && vpOuter%(fixedWidth + gt) > gt) { rightEdge -= 1; }
Expand Down Expand Up @@ -2113,6 +2109,7 @@ var tns = function(options) {
}

if (target && target === prevButton || dir === -1) {
if (!carousel && index === 0) { checkIndex(); }
if (index > indexMin) {
index -= slideBy;
shouldRender = true;
Expand Down
7 changes: 2 additions & 5 deletions src/tiny-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,11 +1162,7 @@ export var tns = function(options) {
var checkIndex = (function () {
if (loop) {
return function () {
var leftEdge = indexMin, rightEdge = indexMax;
if (carousel) {
leftEdge += slideBy;
rightEdge -= slideBy;
}
var leftEdge = indexMin + slideBy, rightEdge = indexMax - slideBy;

var gt = gutter ? gutter : 0;
if (fixedWidth && vpOuter%(fixedWidth + gt) > gt) { rightEdge -= 1; }
Expand Down Expand Up @@ -1733,6 +1729,7 @@ export var tns = function(options) {
}

if (target && target === prevButton || dir === -1) {
if (!carousel && index === 0) { checkIndex(); }
if (index > indexMin) {
index -= slideBy;
shouldRender = true;
Expand Down
7 changes: 2 additions & 5 deletions src/tiny-slider.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,11 +1162,7 @@ export var tns = function(options) {
var checkIndex = (function () {
if (loop) {
return function () {
var leftEdge = indexMin, rightEdge = indexMax;
if (carousel) {
leftEdge += slideBy;
rightEdge -= slideBy;
}
var leftEdge = indexMin + slideBy, rightEdge = indexMax - slideBy;

var gt = gutter ? gutter : 0;
if (fixedWidth && vpOuter%(fixedWidth + gt) > gt) { rightEdge -= 1; }
Expand Down Expand Up @@ -1733,6 +1729,7 @@ export var tns = function(options) {
}

if (target && target === prevButton || dir === -1) {
if (!carousel && index === 0) { checkIndex(); }
if (index > indexMin) {
index -= slideBy;
shouldRender = true;
Expand Down
6 changes: 3 additions & 3 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ <h2>
<div class="autoHeight" id="autoHeight">
<div>
<div>
<img src="images/1000x600/1.png" alt="">
<img src="images/1000x900/1.png" alt="">
</div>
<p>
Sunt dignissimos distinctio, veniam, tenetur aspernatur nulla!
Expand All @@ -1130,15 +1130,15 @@ <h2>
</div>
<div>
<div>
<img src="images/1000x600/4.png" alt="">
<img src="images/1000x700/4.png" alt="">
</div>
<p>
Nisi inventore quo delectus perspiciatis voluptatibus, quae.
</p>
</div>
<div>
<div>
<img src="images/1000x900/5.png" alt="">
<img src="images/1000x600/5.png" alt="">
</div>
<p>
Nisi harum earum consectetur laudantium iusto, laboriosam.
Expand Down
6 changes: 3 additions & 3 deletions tests/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -1634,23 +1634,23 @@ <h2>
<div class="autoHeight" id="autoHeight">
<div>
<div>
<img src="images/1000x800/1.png" alt="">
<img src="images/1000x900/1.png" alt="">
</div>
<p>
Sunt dignissimos distinctio, veniam, tenetur aspernatur nulla!
</p>
</div>
<div>
<div>
<img src="images/1000x800/2.png" alt="">
<img src="images/1000x700/2.png" alt="">
</div>
<p>
Corrupti, libero minima nihil expedita officiis? Quo.
</p>
</div>
<div>
<div>
<img src="images/1000x700/3.png" alt="">
<img src="images/1000x800/3.png" alt="">
</div>
<p>
Alias rem, ab impedit recusandae repellat tempore.
Expand Down

0 comments on commit 1e94968

Please sign in to comment.