Skip to content

Commit

Permalink
Inversing addTrack option to keep defined defaults to a minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
NickPiscitelli committed Apr 14, 2019
1 parent b4b6d08 commit c22d1fa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/assets/js/glider.min.js

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

8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -952,11 +952,11 @@ <h2>Settings</h2>
Whether or not Glider.js events should bubble (useful for binding events to all carousels)
</li>
<li>
<span class="setting-name">addTrack</span><br>
<span class="setting-name">skipTrack</span><br>
<span class="type">Type:</span> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a><br>
<span class="type default">Default:</span> true<br>
Whether or not Glider.js should wrap it's children with a 'glider-track' &lt;div&gt;.
<span class="aside">NOTE: If false, Glider.js will assume that the 'glider-track' element has been added manually. All slides must be children of the track element.</span>
<span class="type default">Default:</span> false<br>
Whether or not Glider.js should skip wrapping it's children with a 'glider-track' &lt;div&gt;.
<span class="aside">NOTE: If true, Glider.js will assume that the 'glider-track' element has been added manually. All slides must be children of the track element.</span>
</li>

</ul>
Expand Down
13 changes: 6 additions & 7 deletions glider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\___//_//_/ \_,_/ \__//_/ (_)__/ //___/
|___/
Version: 1.6.5
Version: 1.6.6
Author: Nick Piscitelli (pickykneee)
Website: https://nickpiscitelli.com
Documentation: http://nickpiscitelli.github.io/Glider.js
Expand Down Expand Up @@ -50,8 +50,7 @@
// easeInQuad
easing: function (x, t, b, c, d) {
return c * (t /= d) * t + b
},
addTrack: true
}
},
settings
)
Expand All @@ -64,16 +63,16 @@
// extend breakpoint settings
_._opt = _.opt

if (_.opt.addTrack) {
if (_.opt.skipTrack) {
// first and only child is the track
_.track = _.ele.children[0]
} else {
// create track and wrap slides
_.track = document.createElement('div')
_.ele.appendChild(_.track)
while (_.ele.children.length !== 1) {
_.track.appendChild(_.ele.children[0])
}
} else {
// first and only child is the track
_.track = _.ele.children[0]
}

_.track.classList.add('glider-track')
Expand Down
Loading

0 comments on commit c22d1fa

Please sign in to comment.