Removed GliderJs from repo
Update LICENSE.txt, glider-compat.min.js, and 4 more files...
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
11
resources/GliderJs/1.7.6/glider-compat.min.js
vendored
11
resources/GliderJs/1.7.6/glider-compat.min.js
vendored
@@ -1,11 +0,0 @@
|
|||||||
"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(b){if("Element"in b){b=b.Element.prototype;var d=Object,g=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array.prototype.indexOf||function(l){for(var f=0,a=this.length;a>f;f++)if(f in this&&this[f]===l)return f;return-1},c=function(a,f){this.name=a;this.code=DOMException[a];this.message=f},h=function(l,
|
|
||||||
f){if(""===f)throw new c("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(f))throw new c("INVALID_CHARACTER_ERR","The token must not contain space characters.");return a.call(l,f)},k=function(a){var f=g.call(a.getAttribute("class")||"");f=f?f.split(/\s+/):[];for(var b=0,h=f.length;h>b;b++)this.push(f[b]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},e=k.prototype=[],m=function(){return new k(this)};if(c.prototype=Error.prototype,e.item=function(a){return this[a]||
|
|
||||||
null},e.contains=function(a){return~h(this,a+"")},e.add=function(){var a=arguments,f=0,b=a.length,c=!1;do{var e=a[f]+"";~h(this,e)||(this.push(e),c=!0)}while(++f<b);c&&this._updateClassName()},e.remove=function(){var a,b=arguments,c=0,e=b.length,k=!1;do{var d=b[c]+"";for(a=h(this,d);~a;)this.splice(a,1),k=!0,a=h(this,d)}while(++c<e);k&&this._updateClassName()},e.toggle=function(a,b){var h=this.contains(a),c=h?!0!==b&&"remove":!1!==b&&"add";return c&&this[c](a),!0===b||!1===b?b:!h},e.replace=function(a,
|
|
||||||
b){var c=h(a+"");~c&&(this.splice(c,1,b),this._updateClassName())},e.toString=function(){return this.join(" ")},d.defineProperty){e={get:m,enumerable:!0,configurable:!0};try{d.defineProperty(b,"classList",e)}catch(l){void 0!==l.number&&-2146823252!==l.number||(e.enumerable=!1,d.defineProperty(b,"classList",e))}}else d.prototype.__defineGetter__&&b.__defineGetter__("classList",m)}}(self),function(){var b=document.createElement("_");if(b.classList.add("c1","c2"),!b.classList.contains("c2")){var d=function(a){var b=
|
|
||||||
DOMTokenList.prototype[a];DOMTokenList.prototype[a]=function(a){var c,h=arguments.length;for(c=0;h>c;c++)a=arguments[c],b.call(this,a)}};d("add");d("remove")}if(b.classList.toggle("c3",!1),b.classList.contains("c3")){var g=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(a,b){return 1 in arguments&&!this.contains(a)==!b?b:g.call(this,a)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(a,b){var c=this.toString().split(" "),d=c.indexOf(a+
|
|
||||||
"");~d&&(c=c.slice(d),this.remove.apply(this,c),this.add(b),this.add.apply(this,c.slice(1)))});b=null}());
|
|
||||||
(function(){if("undefined"!==typeof window)try{var b=new window.CustomEvent("test",{cancelable:!0});b.preventDefault();if(!0!==b.defaultPrevented)throw Error("Could not prevent default");}catch(d){b=function(b,a){a=a||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");c.initCustomEvent(b,a.bubbles,a.cancelable,a.detail);var d=c.preventDefault;c.preventDefault=function(){d.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(k){this.defaultPrevented=
|
|
||||||
!0}};return c},b.prototype=window.Event.prototype,window.CustomEvent=b}})();
|
|
||||||
Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(b){if(void 0===b||null===b)throw new TypeError("Cannot convert first argument to object");for(var d=Object(b),g=1;g<arguments.length;g++){var a=arguments[g];if(void 0!==a&&null!==a){a=Object(a);for(var c=Object.keys(Object(a)),h=0,k=c.length;h<k;h++){var e=c[h],m=Object.getOwnPropertyDescriptor(a,e);void 0!==m&&m.enumerable&&(d[e]=a[e])}}}return d}});
|
|
||||||
(function(){for(var b=0,d=["ms","moz","webkit","o"],g=0;g<d.length&&!window.requestAnimationFrame;++g)window.requestAnimationFrame=window[d[g]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[d[g]+"CancelAnimationFrame"]||window[d[g]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a,c){var d=(new Date).getTime(),g=Math.max(0,16-(d-b)),e=window.setTimeout(function(){a(d+g)},g);b=d+g;return e});window.cancelAnimationFrame||(window.cancelAnimationFrame=
|
|
||||||
function(a){clearTimeout(a)})})();
|
|
@@ -1,129 +0,0 @@
|
|||||||
.glider-contain {
|
|
||||||
width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.glider {
|
|
||||||
margin: 0 auto;
|
|
||||||
position: relative;
|
|
||||||
overflow-y: hidden;
|
|
||||||
-webkit-overflow-scrolling: touch;
|
|
||||||
-ms-overflow-style: none;
|
|
||||||
transform: translateZ(0);
|
|
||||||
}
|
|
||||||
.glider-track {
|
|
||||||
transform: translateZ(0);
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
display: flex;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
.glider.draggable {
|
|
||||||
user-select: none;
|
|
||||||
cursor: -webkit-grab;
|
|
||||||
cursor: grab;
|
|
||||||
}
|
|
||||||
.glider.draggable .glider-slide img {
|
|
||||||
user-select: none;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.glider.drag {
|
|
||||||
cursor: -webkit-grabbing;
|
|
||||||
cursor: grabbing;
|
|
||||||
}
|
|
||||||
.glider-slide {
|
|
||||||
user-select: none;
|
|
||||||
justify-content: center;
|
|
||||||
align-content: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.glider-slide img {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
.glider::-webkit-scrollbar {
|
|
||||||
opacity: 0;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
.glider-prev,.glider-next {
|
|
||||||
user-select: none;
|
|
||||||
position: absolute;
|
|
||||||
outline: none;
|
|
||||||
background: none;
|
|
||||||
padding: 0;
|
|
||||||
z-index: 2;
|
|
||||||
font-size: 40px;
|
|
||||||
text-decoration: none;
|
|
||||||
left: -23px;
|
|
||||||
border: 0;
|
|
||||||
top: 30%;
|
|
||||||
cursor: pointer;
|
|
||||||
color: #666;
|
|
||||||
opacity: 1;
|
|
||||||
line-height: 1;
|
|
||||||
transition: opacity .5s cubic-bezier(.17,.67,.83,.67),
|
|
||||||
color .5s cubic-bezier(.17,.67,.83,.67);
|
|
||||||
}
|
|
||||||
.glider-prev:hover,
|
|
||||||
.glider-next:hover,
|
|
||||||
.glider-prev:focus,
|
|
||||||
.glider-next:focus {
|
|
||||||
color: #a89cc8;
|
|
||||||
}
|
|
||||||
.glider-next {
|
|
||||||
right: -23px;
|
|
||||||
left: auto;
|
|
||||||
}
|
|
||||||
.glider-next.disabled,
|
|
||||||
.glider-prev.disabled {
|
|
||||||
opacity: .25;
|
|
||||||
color: #666;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
.glider-slide {
|
|
||||||
min-width: 150px;
|
|
||||||
}
|
|
||||||
.glider-hide {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
.glider-dots {
|
|
||||||
user-select: none;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: center;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
.glider-dot {
|
|
||||||
border: 0;
|
|
||||||
padding: 0;
|
|
||||||
user-select: none;
|
|
||||||
outline: none;
|
|
||||||
display: block;
|
|
||||||
cursor: pointer;
|
|
||||||
color: #ccc;
|
|
||||||
border-radius: 999px;
|
|
||||||
background: #ccc;
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
margin: 7px;
|
|
||||||
}
|
|
||||||
.glider-dot:hover,
|
|
||||||
.glider-dot:focus,
|
|
||||||
.glider-dot.active {
|
|
||||||
background: #a89cc8;
|
|
||||||
}
|
|
||||||
@media(max-width: 36em){
|
|
||||||
.glider::-webkit-scrollbar {
|
|
||||||
opacity: 1;
|
|
||||||
-webkit-appearance: none;
|
|
||||||
width: 7px;
|
|
||||||
height: 3px;
|
|
||||||
}
|
|
||||||
.glider::-webkit-scrollbar-thumb {
|
|
||||||
opacity: 1;
|
|
||||||
border-radius: 99px;
|
|
||||||
background-color: rgba(156, 156, 156, 0.25);
|
|
||||||
box-shadow: 0 0 1px rgba(255,255,255,.25);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,576 +0,0 @@
|
|||||||
/* @preserve
|
|
||||||
_____ __ _ __ _
|
|
||||||
/ ___// /(_)___/ /___ ____ (_)___
|
|
||||||
/ (_ // // // _ // -_)/ __/_ / /(_-<
|
|
||||||
\___//_//_/ \_,_/ \__//_/ (_)__/ //___/
|
|
||||||
|___/
|
|
||||||
|
|
||||||
Version: 1.7.4
|
|
||||||
Author: Nick Piscitelli (pickykneee)
|
|
||||||
Website: https://nickpiscitelli.com
|
|
||||||
Documentation: http://nickpiscitelli.github.io/Glider.js
|
|
||||||
License: MIT License
|
|
||||||
Release Date: October 25th, 2018
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* global define */
|
|
||||||
|
|
||||||
(function (factory) {
|
|
||||||
typeof define === 'function' && define.amd
|
|
||||||
? define(factory)
|
|
||||||
: typeof exports === 'object'
|
|
||||||
? (module.exports = factory())
|
|
||||||
: factory()
|
|
||||||
})(function () {
|
|
||||||
('use strict') // eslint-disable-line no-unused-expressions
|
|
||||||
|
|
||||||
/* globals window:true */
|
|
||||||
var _window = typeof window !== 'undefined' ? window : this
|
|
||||||
|
|
||||||
var Glider = (_window.Glider = function (element, settings) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
if (element._glider) return element._glider
|
|
||||||
|
|
||||||
_.ele = element
|
|
||||||
_.ele.classList.add('glider')
|
|
||||||
|
|
||||||
// expose glider object to its DOM element
|
|
||||||
_.ele._glider = _
|
|
||||||
|
|
||||||
// merge user setting with defaults
|
|
||||||
_.opt = Object.assign(
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
slidesToScroll: 1,
|
|
||||||
slidesToShow: 1,
|
|
||||||
resizeLock: true,
|
|
||||||
duration: 0.5,
|
|
||||||
// easeInQuad
|
|
||||||
easing: function (x, t, b, c, d) {
|
|
||||||
return c * (t /= d) * t + b
|
|
||||||
}
|
|
||||||
},
|
|
||||||
settings
|
|
||||||
)
|
|
||||||
|
|
||||||
// set defaults
|
|
||||||
_.animate_id = _.page = _.slide = _.scrollLeft = 0
|
|
||||||
_.arrows = {}
|
|
||||||
|
|
||||||
// preserve original options to
|
|
||||||
// extend breakpoint settings
|
|
||||||
_._opt = _.opt
|
|
||||||
|
|
||||||
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])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_.track.classList.add('glider-track')
|
|
||||||
|
|
||||||
// start glider
|
|
||||||
_.init()
|
|
||||||
|
|
||||||
// set events
|
|
||||||
_.resize = _.init.bind(_, true)
|
|
||||||
_.event(_.ele, 'add', {
|
|
||||||
scroll: _.updateControls.bind(_)
|
|
||||||
})
|
|
||||||
_.event(_window, 'add', {
|
|
||||||
resize: _.resize
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
var gliderPrototype = Glider.prototype
|
|
||||||
gliderPrototype.init = function (refresh, paging) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
var width = 0
|
|
||||||
|
|
||||||
var height = 0
|
|
||||||
|
|
||||||
_.slides = _.track.children;
|
|
||||||
|
|
||||||
[].forEach.call(_.slides, function (_, i) {
|
|
||||||
_.classList.add('glider-slide')
|
|
||||||
_.setAttribute('data-gslide', i)
|
|
||||||
})
|
|
||||||
|
|
||||||
_.containerWidth = _.ele.clientWidth
|
|
||||||
|
|
||||||
var breakpointChanged = _.settingsBreakpoint()
|
|
||||||
if (!paging) paging = breakpointChanged
|
|
||||||
|
|
||||||
if (
|
|
||||||
_.opt.slidesToShow === 'auto' ||
|
|
||||||
typeof _.opt._autoSlide !== 'undefined'
|
|
||||||
) {
|
|
||||||
var slideCount = _.containerWidth / _.opt.itemWidth
|
|
||||||
|
|
||||||
_.opt._autoSlide = _.opt.slidesToShow = _.opt.exactWidth
|
|
||||||
? slideCount
|
|
||||||
: Math.floor(slideCount)
|
|
||||||
}
|
|
||||||
if (_.opt.slidesToScroll === 'auto') {
|
|
||||||
_.opt.slidesToScroll = Math.floor(_.opt.slidesToShow)
|
|
||||||
}
|
|
||||||
|
|
||||||
_.itemWidth = _.opt.exactWidth
|
|
||||||
? _.opt.itemWidth
|
|
||||||
: _.containerWidth / _.opt.slidesToShow;
|
|
||||||
|
|
||||||
// set slide dimensions
|
|
||||||
[].forEach.call(_.slides, function (__) {
|
|
||||||
__.style.height = 'auto'
|
|
||||||
__.style.width = _.itemWidth + 'px'
|
|
||||||
width += _.itemWidth
|
|
||||||
height = Math.max(__.offsetHeight, height)
|
|
||||||
})
|
|
||||||
|
|
||||||
_.track.style.width = width + 'px'
|
|
||||||
_.trackWidth = width
|
|
||||||
_.isDrag = false
|
|
||||||
_.preventClick = false
|
|
||||||
|
|
||||||
_.opt.resizeLock && _.scrollTo(_.slide * _.itemWidth, 0)
|
|
||||||
|
|
||||||
if (breakpointChanged || paging) {
|
|
||||||
_.bindArrows()
|
|
||||||
_.buildDots()
|
|
||||||
_.bindDrag()
|
|
||||||
}
|
|
||||||
|
|
||||||
_.updateControls()
|
|
||||||
|
|
||||||
_.emit(refresh ? 'refresh' : 'loaded')
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.bindDrag = function () {
|
|
||||||
var _ = this
|
|
||||||
_.mouse = _.mouse || _.handleMouse.bind(_)
|
|
||||||
|
|
||||||
var mouseup = function () {
|
|
||||||
_.mouseDown = undefined
|
|
||||||
_.ele.classList.remove('drag')
|
|
||||||
if (_.isDrag) {
|
|
||||||
_.preventClick = true
|
|
||||||
}
|
|
||||||
_.isDrag = false
|
|
||||||
}
|
|
||||||
|
|
||||||
var events = {
|
|
||||||
mouseup: mouseup,
|
|
||||||
mouseleave: mouseup,
|
|
||||||
mousedown: function (e) {
|
|
||||||
e.preventDefault()
|
|
||||||
e.stopPropagation()
|
|
||||||
_.mouseDown = e.clientX
|
|
||||||
_.ele.classList.add('drag')
|
|
||||||
},
|
|
||||||
mousemove: _.mouse,
|
|
||||||
click: function (e) {
|
|
||||||
if (_.preventClick) {
|
|
||||||
e.preventDefault()
|
|
||||||
e.stopPropagation()
|
|
||||||
}
|
|
||||||
_.preventClick = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_.ele.classList.toggle('draggable', _.opt.draggable === true)
|
|
||||||
_.event(_.ele, 'remove', events)
|
|
||||||
if (_.opt.draggable) _.event(_.ele, 'add', events)
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.buildDots = function () {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
if (!_.opt.dots) {
|
|
||||||
if (_.dots) _.dots.innerHTML = ''
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof _.opt.dots === 'string') {
|
|
||||||
_.dots = document.querySelector(_.opt.dots)
|
|
||||||
} else _.dots = _.opt.dots
|
|
||||||
if (!_.dots) return
|
|
||||||
|
|
||||||
_.dots.innerHTML = ''
|
|
||||||
_.dots.classList.add('glider-dots')
|
|
||||||
|
|
||||||
for (var i = 0; i < Math.ceil(_.slides.length / _.opt.slidesToShow); ++i) {
|
|
||||||
var dot = document.createElement('button')
|
|
||||||
dot.dataset.index = i
|
|
||||||
dot.setAttribute('aria-label', 'Page ' + (i + 1))
|
|
||||||
dot.className = 'glider-dot ' + (i ? '' : 'active')
|
|
||||||
_.event(dot, 'add', {
|
|
||||||
click: _.scrollItem.bind(_, i, true)
|
|
||||||
})
|
|
||||||
_.dots.appendChild(dot)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.bindArrows = function () {
|
|
||||||
var _ = this
|
|
||||||
if (!_.opt.arrows) {
|
|
||||||
Object.keys(_.arrows).forEach(function (direction) {
|
|
||||||
var element = _.arrows[direction]
|
|
||||||
_.event(element, 'remove', { click: element._func })
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
['prev', 'next'].forEach(function (direction) {
|
|
||||||
var arrow = _.opt.arrows[direction]
|
|
||||||
if (arrow) {
|
|
||||||
if (typeof arrow === 'string') arrow = document.querySelector(arrow)
|
|
||||||
if (arrow) {
|
|
||||||
arrow._func = arrow._func || _.scrollItem.bind(_, direction)
|
|
||||||
_.event(arrow, 'remove', {
|
|
||||||
click: arrow._func
|
|
||||||
})
|
|
||||||
_.event(arrow, 'add', {
|
|
||||||
click: arrow._func
|
|
||||||
})
|
|
||||||
_.arrows[direction] = arrow
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.updateControls = function (event) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
if (event && !_.opt.scrollPropagate) {
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
|
|
||||||
var disableArrows = _.containerWidth >= _.trackWidth
|
|
||||||
|
|
||||||
if (!_.opt.rewind) {
|
|
||||||
if (_.arrows.prev) {
|
|
||||||
_.arrows.prev.classList.toggle(
|
|
||||||
'disabled',
|
|
||||||
_.ele.scrollLeft <= 0 || disableArrows
|
|
||||||
)
|
|
||||||
_.arrows.prev.classList.contains('disabled')
|
|
||||||
? _.arrows.prev.setAttribute('aria-disabled', true)
|
|
||||||
: _.arrows.prev.setAttribute('aria-disabled', false)
|
|
||||||
}
|
|
||||||
if (_.arrows.next) {
|
|
||||||
_.arrows.next.classList.toggle(
|
|
||||||
'disabled',
|
|
||||||
Math.ceil(_.scrollLeft + _.containerWidth) >=
|
|
||||||
Math.floor(_.trackWidth) || disableArrows
|
|
||||||
)
|
|
||||||
_.arrows.next.classList.contains('disabled')
|
|
||||||
? _.arrows.next.setAttribute('aria-disabled', true)
|
|
||||||
: _.arrows.next.setAttribute('aria-disabled', false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_.slide = Math.round(_.scrollLeft / _.itemWidth)
|
|
||||||
_.page = Math.round(_.scrollLeft / _.containerWidth)
|
|
||||||
|
|
||||||
var middle = _.slide + Math.floor(Math.floor(_.opt.slidesToShow) / 2)
|
|
||||||
|
|
||||||
var extraMiddle = Math.floor(_.opt.slidesToShow) % 2 ? 0 : middle + 1
|
|
||||||
if (Math.floor(_.opt.slidesToShow) === 1) {
|
|
||||||
extraMiddle = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// the last page may be less than one half of a normal page width so
|
|
||||||
// the page is rounded down. when at the end, force the page to turn
|
|
||||||
if (_.scrollLeft + _.containerWidth >= Math.floor(_.trackWidth)) {
|
|
||||||
_.page = _.dots ? _.dots.children.length - 1 : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
[].forEach.call(_.slides, function (slide, index) {
|
|
||||||
var slideClasses = slide.classList
|
|
||||||
|
|
||||||
var wasVisible = slideClasses.contains('visible')
|
|
||||||
|
|
||||||
var start = _.scrollLeft
|
|
||||||
|
|
||||||
var end = _.scrollLeft + _.containerWidth
|
|
||||||
|
|
||||||
var itemStart = _.itemWidth * index
|
|
||||||
|
|
||||||
var itemEnd = itemStart + _.itemWidth;
|
|
||||||
|
|
||||||
[].forEach.call(slideClasses, function (className) {
|
|
||||||
/^left|right/.test(className) && slideClasses.remove(className)
|
|
||||||
})
|
|
||||||
slideClasses.toggle('active', _.slide === index)
|
|
||||||
if (middle === index || (extraMiddle && extraMiddle === index)) {
|
|
||||||
slideClasses.add('center')
|
|
||||||
} else {
|
|
||||||
slideClasses.remove('center')
|
|
||||||
slideClasses.add(
|
|
||||||
[
|
|
||||||
index < middle ? 'left' : 'right',
|
|
||||||
Math.abs(index - (index < middle ? middle : extraMiddle || middle))
|
|
||||||
].join('-')
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
var isVisible =
|
|
||||||
Math.ceil(itemStart) >= Math.floor(start) &&
|
|
||||||
Math.floor(itemEnd) <= Math.ceil(end)
|
|
||||||
slideClasses.toggle('visible', isVisible)
|
|
||||||
if (isVisible !== wasVisible) {
|
|
||||||
_.emit('slide-' + (isVisible ? 'visible' : 'hidden'), {
|
|
||||||
slide: index
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (_.dots) {
|
|
||||||
[].forEach.call(_.dots.children, function (dot, index) {
|
|
||||||
dot.classList.toggle('active', _.page === index)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event && _.opt.scrollLock) {
|
|
||||||
clearTimeout(_.scrollLock)
|
|
||||||
_.scrollLock = setTimeout(function () {
|
|
||||||
clearTimeout(_.scrollLock)
|
|
||||||
// dont attempt to scroll less than a pixel fraction - causes looping
|
|
||||||
if (Math.abs(_.ele.scrollLeft / _.itemWidth - _.slide) > 0.02) {
|
|
||||||
if (!_.mouseDown) {
|
|
||||||
// Only scroll if not at the end (#94)
|
|
||||||
if (_.trackWidth > _.containerWidth + _.ele.scrollLeft) {
|
|
||||||
_.scrollItem(_.getCurrentSlide())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, _.opt.scrollLockDelay || 250)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.getCurrentSlide = function () {
|
|
||||||
var _ = this
|
|
||||||
return _.round(_.ele.scrollLeft / _.itemWidth)
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.scrollItem = function (slide, dot, e) {
|
|
||||||
if (e) e.preventDefault()
|
|
||||||
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
var originalSlide = slide
|
|
||||||
++_.animate_id
|
|
||||||
|
|
||||||
if (dot === true) {
|
|
||||||
slide = slide * _.containerWidth
|
|
||||||
slide = Math.round(slide / _.itemWidth) * _.itemWidth
|
|
||||||
} else {
|
|
||||||
if (typeof slide === 'string') {
|
|
||||||
var backwards = slide === 'prev'
|
|
||||||
|
|
||||||
// use precise location if fractional slides are on
|
|
||||||
if (_.opt.slidesToScroll % 1 || _.opt.slidesToShow % 1) {
|
|
||||||
slide = _.getCurrentSlide()
|
|
||||||
} else {
|
|
||||||
slide = _.slide
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backwards) slide -= _.opt.slidesToScroll
|
|
||||||
else slide += _.opt.slidesToScroll
|
|
||||||
|
|
||||||
if (_.opt.rewind) {
|
|
||||||
var scrollLeft = _.ele.scrollLeft
|
|
||||||
slide =
|
|
||||||
backwards && !scrollLeft
|
|
||||||
? _.slides.length
|
|
||||||
: !backwards &&
|
|
||||||
scrollLeft + _.containerWidth >= Math.floor(_.trackWidth)
|
|
||||||
? 0
|
|
||||||
: slide
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
slide = Math.max(Math.min(slide, _.slides.length), 0)
|
|
||||||
|
|
||||||
_.slide = slide
|
|
||||||
slide = _.itemWidth * slide
|
|
||||||
}
|
|
||||||
|
|
||||||
_.scrollTo(
|
|
||||||
slide,
|
|
||||||
_.opt.duration * Math.abs(_.ele.scrollLeft - slide),
|
|
||||||
function () {
|
|
||||||
_.updateControls()
|
|
||||||
_.emit('animated', {
|
|
||||||
value: originalSlide,
|
|
||||||
type:
|
|
||||||
typeof originalSlide === 'string' ? 'arrow' : dot ? 'dot' : 'slide'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.settingsBreakpoint = function () {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
var resp = _._opt.responsive
|
|
||||||
|
|
||||||
if (resp) {
|
|
||||||
// Sort the breakpoints in mobile first order
|
|
||||||
resp.sort(function (a, b) {
|
|
||||||
return b.breakpoint - a.breakpoint
|
|
||||||
})
|
|
||||||
|
|
||||||
for (var i = 0; i < resp.length; ++i) {
|
|
||||||
var size = resp[i]
|
|
||||||
if (_window.innerWidth >= size.breakpoint) {
|
|
||||||
if (_.breakpoint !== size.breakpoint) {
|
|
||||||
_.opt = Object.assign({}, _._opt, size.settings)
|
|
||||||
_.breakpoint = size.breakpoint
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// set back to defaults in case they were overriden
|
|
||||||
var breakpointChanged = _.breakpoint !== 0
|
|
||||||
_.opt = Object.assign({}, _._opt)
|
|
||||||
_.breakpoint = 0
|
|
||||||
return breakpointChanged
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.scrollTo = function (scrollTarget, scrollDuration, callback) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
var start = new Date().getTime()
|
|
||||||
|
|
||||||
var animateIndex = _.animate_id
|
|
||||||
|
|
||||||
var animate = function () {
|
|
||||||
var now = new Date().getTime() - start
|
|
||||||
_.scrollLeft =
|
|
||||||
_.scrollLeft +
|
|
||||||
(scrollTarget - _.scrollLeft) *
|
|
||||||
_.opt.easing(0, now, 0, 1, scrollDuration)
|
|
||||||
_.ele.scrollLeft = _.scrollLeft
|
|
||||||
|
|
||||||
if (now < scrollDuration && animateIndex === _.animate_id) {
|
|
||||||
_window.requestAnimationFrame(animate)
|
|
||||||
} else {
|
|
||||||
_.ele.scrollLeft = _.scrollLeft = scrollTarget
|
|
||||||
callback && callback.call(_)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_window.requestAnimationFrame(animate)
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.removeItem = function (index) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
if (_.slides.length) {
|
|
||||||
_.track.removeChild(_.slides[index])
|
|
||||||
_.refresh(true)
|
|
||||||
_.emit('remove')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.addItem = function (ele) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
_.track.appendChild(ele)
|
|
||||||
_.refresh(true)
|
|
||||||
_.emit('add')
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.handleMouse = function (e) {
|
|
||||||
var _ = this
|
|
||||||
if (_.mouseDown) {
|
|
||||||
_.isDrag = true
|
|
||||||
_.scrollLeft += (_.mouseDown - e.clientX) * (_.opt.dragVelocity || 3.3)
|
|
||||||
_.mouseDown = e.clientX
|
|
||||||
_.ele.scrollLeft = _.scrollLeft
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// used to round to the nearest 0.XX fraction
|
|
||||||
gliderPrototype.round = function (double) {
|
|
||||||
var _ = this
|
|
||||||
var step = _.opt.slidesToScroll % 1 || 1
|
|
||||||
var inv = 1.0 / step
|
|
||||||
return Math.round(double * inv) / inv
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.refresh = function (paging) {
|
|
||||||
var _ = this
|
|
||||||
_.init(true, paging)
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.setOption = function (opt, global) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
if (_.breakpoint && !global) {
|
|
||||||
_._opt.responsive.forEach(function (v) {
|
|
||||||
if (v.breakpoint === _.breakpoint) {
|
|
||||||
v.settings = Object.assign({}, v.settings, opt)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
_._opt = Object.assign({}, _._opt, opt)
|
|
||||||
}
|
|
||||||
|
|
||||||
_.breakpoint = 0
|
|
||||||
_.settingsBreakpoint()
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.destroy = function () {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
var replace = _.ele.cloneNode(true)
|
|
||||||
|
|
||||||
var clear = function (ele) {
|
|
||||||
ele.removeAttribute('style');
|
|
||||||
[].forEach.call(ele.classList, function (className) {
|
|
||||||
/^glider/.test(className) && ele.classList.remove(className)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// remove track
|
|
||||||
replace.children[0].outerHTML = replace.children[0].innerHTML
|
|
||||||
clear(replace);
|
|
||||||
[].forEach.call(replace.getElementsByTagName('*'), clear)
|
|
||||||
_.ele.parentNode.replaceChild(replace, _.ele)
|
|
||||||
_.event(_window, 'remove', {
|
|
||||||
resize: _.resize
|
|
||||||
})
|
|
||||||
_.emit('destroy')
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.emit = function (name, arg) {
|
|
||||||
var _ = this
|
|
||||||
|
|
||||||
var e = new _window.CustomEvent('glider-' + name, {
|
|
||||||
bubbles: !_.opt.eventPropagate,
|
|
||||||
detail: arg
|
|
||||||
})
|
|
||||||
_.ele.dispatchEvent(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
gliderPrototype.event = function (ele, type, args) {
|
|
||||||
var eventHandler = ele[type + 'EventListener'].bind(ele)
|
|
||||||
Object.keys(args).forEach(function (k) {
|
|
||||||
eventHandler(k, args[k])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return Glider
|
|
||||||
})
|
|
1
resources/GliderJs/1.7.6/glider.min.css
vendored
1
resources/GliderJs/1.7.6/glider.min.css
vendored
@@ -1 +0,0 @@
|
|||||||
.glider,.glider-contain{margin:0 auto;position:relative}.glider,.glider-track{transform:translateZ(0)}.glider-dot,.glider-next,.glider-prev{border:0;padding:0;user-select:none;outline:0}.glider-contain{width:100%}.glider{overflow-y:hidden;-webkit-overflow-scrolling:touch;-ms-overflow-style:none}.glider-track{width:100%;margin:0;padding:0;display:flex;z-index:1}.glider.draggable{user-select:none;cursor:-webkit-grab;cursor:grab}.glider.draggable .glider-slide img{user-select:none;pointer-events:none}.glider.drag{cursor:-webkit-grabbing;cursor:grabbing}.glider-slide{user-select:none;justify-content:center;align-content:center;width:100%;min-width:150px}.glider-slide img{max-width:100%}.glider::-webkit-scrollbar{opacity:0;height:0}.glider-next,.glider-prev{position:absolute;background:0 0;z-index:2;font-size:40px;text-decoration:none;left:-23px;top:30%;cursor:pointer;color:#666;opacity:1;line-height:1;transition:opacity .5s cubic-bezier(.17,.67,.83,.67),color .5s cubic-bezier(.17,.67,.83,.67)}.glider-next:focus,.glider-next:hover,.glider-prev:focus,.glider-prev:hover{color:#ccc}.glider-next{right:-23px;left:auto}.glider-next.disabled,.glider-prev.disabled{opacity:.25;color:#666;cursor:default}.glider-hide{opacity:0}.glider-dots{user-select:none;display:flex;flex-wrap:wrap;justify-content:center;margin:0 auto;padding:0}.glider-dot{display:block;cursor:pointer;color:#ccc;border-radius:999px;background:#ccc;width:12px;height:12px;margin:7px}.glider-dot:focus,.glider-dot:hover{background:#ddd}.glider-dot.active{background:#a89cc8}@media(max-width:36em){.glider::-webkit-scrollbar{opacity:1;-webkit-appearance:none;width:7px;height:3px}.glider::-webkit-scrollbar-thumb{opacity:1;border-radius:99px;background-color:rgba(156,156,156,.25);-webkit-box-shadow:0 0 1px rgba(255,255,255,.25);box-shadow:0 0 1px rgba(255,255,255,.25)}}
|
|
16
resources/GliderJs/1.7.6/glider.min.js
vendored
16
resources/GliderJs/1.7.6/glider.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user