Skip to content
Permalink
Browse files

simplify getIndexMax() for autoWidth

  • Loading branch information...
ganlanyuan committed Dec 22, 2018
1 parent c61b0b1 commit 87c984cf15a04e02ed5e202ba1cbb29dde30deb3
@@ -1534,6 +1534,9 @@ <h2>
<script src="../dist/tiny-slider.js"></script>
<script>
// <script type="module">
// import { tns } from '../src/tiny-slider.js';
var options = {
'base': {
container: '',

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -734,8 +734,8 @@ var tns = function(options) {
return function() { return center && !loop ? slideCount - 1 : Math.ceil(- rightBoundary / (fixedWidth + gutter)); };
} else if (autoWidth) {
return function() {
for (var i = slideCountNew, result = i - 1; i--;) {
if (slidePositions[i] > - rightBoundary) { return i; }
for (var i = slideCountNew; i--;) {
if (slidePositions[i] >= - rightBoundary) { return i; }
}
};
} else {
@@ -302,8 +302,8 @@ export var tns = function(options) {
return function() { return center && !loop ? slideCount - 1 : Math.ceil(- rightBoundary / (fixedWidth + gutter)); };
} else if (autoWidth) {
return function() {
for (var i = slideCountNew, result = i - 1; i--;) {
if (slidePositions[i] > - rightBoundary) { return i; }
for (var i = slideCountNew; i--;) {
if (slidePositions[i] >= - rightBoundary) { return i; }
}
};
} else {
@@ -302,8 +302,8 @@ export var tns = function(options) {
return function() { return center && !loop ? slideCount - 1 : Math.ceil(- rightBoundary / (fixedWidth + gutter)); };
} else if (autoWidth) {
return function() {
for (var i = slideCountNew, result = i - 1; i--;) {
if (slidePositions[i] > - rightBoundary) { return i; }
for (var i = slideCountNew; i--;) {
if (slidePositions[i] >= - rightBoundary) { return i; }
}
};
} else {
@@ -45,7 +45,7 @@
'autoHeight',
'nested'
] %}
{# {% set sliders = ['fixedWidth-gutter'] %} #}
{# {% set sliders = ['autoWidth-non-loop'] %} #}

{% set titles = [
"Lorem ipsum dolor sit amet, consectetur adipisicing.",
@@ -286,10 +286,11 @@
window.addEventListener('resize', function() { fw = getFW(ww); });
</script>

{# <script type="module"> #}
{# import { tns } from '../src/tiny-slider.js'; #}
<script src="../dist/tiny-slider.js"></script>
<script>
// <script type="module">
// import { tns } from '../src/tiny-slider.js';
var options = {
'base': {
container: '',

0 comments on commit 87c984c

Please sign in to comment.
You can’t perform that action at this time.