diff --git a/.gitignore b/.gitignore index 3f66d7b..5e427d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .config .npm +/*~ diff --git a/glider.css b/glider.css index 4422543..d621bce 100644 --- a/glider.css +++ b/glider.css @@ -19,6 +19,13 @@ display: flex; z-index: 1; } +.label-dots .glider-dot { + width: 1.1rem; + height: 1.1rem; + font-size: 1rem; + line-height: 1; + padding-bottom: 2px; +} .glider.draggable { user-select: none; cursor: -webkit-grab; diff --git a/glider.js b/glider.js index 78e5adb..9598def 100644 --- a/glider.js +++ b/glider.js @@ -47,6 +47,7 @@ slidesToShow: 1, resizeLock: true, duration: 0.5, + labelDots:false, // easeInQuad easing: function (x, t, b, c, d) { return c * (t /= d) * t + b @@ -206,6 +207,7 @@ _.dots.innerHTML = '' _.dots.classList.add('glider-dots') + if(false !== _.opt.labelDots) _.dots.classList.add('label-dots') for (var i = 0; i < Math.ceil(_.slides.length / _.opt.slidesToShow); ++i) { var dot = document.createElement('button') @@ -213,6 +215,10 @@ dot.setAttribute('aria-label', 'Page ' + (i + 1)) dot.setAttribute('role', 'tab') dot.className = 'glider-dot ' + (i ? '' : 'active') + if(false !== _.opt.labelDots){ + if(_.opt.labelDots[i]) dot.innerText = _.opt.labelDots[i] + else dot.innerText = (i+1) + } _.event(dot, 'add', { click: _.scrollItem.bind(_, i, true) })