Skip to content

Commit

Permalink
Fractional slide tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
NickPiscitelli committed Nov 11, 2018
1 parent 670172f commit f53ed2b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
9 changes: 7 additions & 2 deletions docs/assets/js/glider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
\___//_//_/ \_,_/ \__//_/ (_)__/ //___/
|___/
Version: 1.3
Version: 1.4
Author: Nick Piscitelli (pickykneee)
Website: https://nickpiscitelli.com
Documentation: http://nickpiscitelli.github.io/Glider.js
License: MIT License
Release Date: October 25th, 2018
Last Update: November 10th, 2018
*/

(function() {
Expand Down Expand Up @@ -82,6 +82,7 @@
});

_.containerWidth = _.ele.clientWidth;

_.opt = _._opt;

var breakpointChanged = _.settingsBreakpoint();
Expand Down Expand Up @@ -170,6 +171,10 @@

_.slide = Math.round(_.ele.scrollLeft / _.itemWidth);
_.page = Math.round(_.ele.scrollLeft / _.containerWidth);
if (_.ele.scrollLeft + _.containerWidth >= _.trackWidth){
_.page = _.dots ? _.dots.children.length - 1 : 0;
_.slide = _.slides.length - 1;
}

[].forEach.call(_.slides,function(slide,index){
var
Expand Down
12 changes: 6 additions & 6 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
\___//_//_/ \_,_/ \__//_/ (_)__/ //___/
|___/
Version: 1.3
Version: 1.4
Author: Nick Piscitelli (pickykneee)
Website: https://nickpiscitelli.com
License: MIT License
Expand Down Expand Up @@ -383,7 +383,7 @@ <h2>Scroll Locking</h2>
</div>

<div class="demo">
<h2>Cut-Off Slides</h2>
<h2>Fractional Slides</h2>
<div data-name="Fractional Slides" class="glider-contain multiple">
<div class="gradient-border-bottom">
<div class="gradient-border">
Expand All @@ -404,7 +404,6 @@ <h2>Cut-Off Slides</h2>
<div><h1>14</h1></div>
<div><h1>15</h1></div>
<div><h1>16</h1></div>
<div><h1>17</h1></div>
</div>
</div>
</div>
Expand All @@ -414,8 +413,8 @@ <h2>Cut-Off Slides</h2>
</div>
<script>
var glider = new Glider(document.getElementById('glider-cut'), {
slidesToShow: 3.5,
slidesToScroll: 1,
slidesToScroll: 1.337,
slidesToShow: 5.555,
dots: '#frac-dots',
arrows: {
prev: '#cut-prev',
Expand All @@ -427,7 +426,8 @@ <h2>Cut-Off Slides</h2>
<pre class="line-numbers language-javascript">
<code class="line-numbers language-javascript">
new Glider(document.querySelector('.glider'), {
slidesToShow: 3.5,
slidesToScroll: 1.337,
slidesToShow: 7.777,
dots: '.dots',
arrows: {
prev: '.glider-prev',
Expand Down
9 changes: 7 additions & 2 deletions glider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
\___//_//_/ \_,_/ \__//_/ (_)__/ //___/
|___/
Version: 1.3
Version: 1.4
Author: Nick Piscitelli (pickykneee)
Website: https://nickpiscitelli.com
Documentation: http://nickpiscitelli.github.io/Glider.js
License: MIT License
Release Date: October 25th, 2018
Last Update: November 10th, 2018
*/

(function() {
Expand Down Expand Up @@ -82,6 +82,7 @@
});

_.containerWidth = _.ele.clientWidth;

_.opt = _._opt;

var breakpointChanged = _.settingsBreakpoint();
Expand Down Expand Up @@ -170,6 +171,10 @@

_.slide = Math.round(_.ele.scrollLeft / _.itemWidth);
_.page = Math.round(_.ele.scrollLeft / _.containerWidth);
if (_.ele.scrollLeft + _.containerWidth >= _.trackWidth){
_.page = _.dots ? _.dots.children.length - 1 : 0;
_.slide = _.slides.length - 1;
}

[].forEach.call(_.slides,function(slide,index){
var
Expand Down
14 changes: 7 additions & 7 deletions glider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f53ed2b

Please sign in to comment.