Skip to content

Commit a659d36

Browse files
chore: build
1 parent 3c3e627 commit a659d36

File tree

4 files changed

+172
-46
lines changed

4 files changed

+172
-46
lines changed

dist/glide.esm.js

+57-15
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ function Sizes (Glide, Components, Events) {
17721772
* @return {Number}
17731773
*/
17741774
get: function get() {
1775-
return Components.Html.root.offsetWidth;
1775+
return Components.Html.track.offsetWidth;
17761776
}
17771777
});
17781778
define(Sizes, 'wrapperSize', {
@@ -2452,7 +2452,12 @@ function Translate (Glide, Components, Events) {
24522452
*/
24532453
set: function set(value) {
24542454
var transform = mutator(Glide, Components).mutate(value);
2455-
Components.Html.wrapper.style.transform = "translate3d(".concat(-1 * transform, "px, 0px, 0px)");
2455+
var translate3d = "translate3d(".concat(-1 * transform, "px, 0px, 0px)");
2456+
Components.Html.wrapper.style.mozTransform = translate3d; // needed for supported Firefox 10-15
2457+
2458+
Components.Html.wrapper.style.webkitTransform = translate3d; // needed for supported Chrome 10-35, Safari 5.1-8, and Opera 15-22
2459+
2460+
Components.Html.wrapper.style.transform = translate3d;
24562461
},
24572462

24582463
/**
@@ -3077,8 +3082,6 @@ function Anchors (Glide, Components, Events) {
30773082
if (!detached) {
30783083
for (var i = 0; i < this.items.length; i++) {
30793084
this.items[i].draggable = false;
3080-
this.items[i].setAttribute('data-href', this.items[i].getAttribute('href'));
3081-
this.items[i].removeAttribute('href');
30823085
}
30833086

30843087
detached = true;
@@ -3098,7 +3101,6 @@ function Anchors (Glide, Components, Events) {
30983101
if (detached) {
30993102
for (var i = 0; i < this.items.length; i++) {
31003103
this.items[i].draggable = true;
3101-
this.items[i].setAttribute('href', this.items[i].getAttribute('data-href'));
31023104
}
31033105

31043106
detached = false;
@@ -3516,13 +3518,32 @@ function Autoplay (Glide, Components, Events) {
35163518
* @return {Void}
35173519
*/
35183520
mount: function mount() {
3521+
this.enable();
35193522
this.start();
35203523

35213524
if (Glide.settings.hoverpause) {
35223525
this.bind();
35233526
}
35243527
},
35253528

3529+
/**
3530+
* Enables autoplaying
3531+
*
3532+
* @returns {Void}
3533+
*/
3534+
enable: function enable() {
3535+
this._e = true;
3536+
},
3537+
3538+
/**
3539+
* Disables autoplaying.
3540+
*
3541+
* @returns {Void}
3542+
*/
3543+
disable: function disable() {
3544+
this._e = false;
3545+
},
3546+
35263547
/**
35273548
* Starts autoplaying in configured interval.
35283549
*
@@ -3532,6 +3553,12 @@ function Autoplay (Glide, Components, Events) {
35323553
start: function start() {
35333554
var _this = this;
35343555

3556+
if (!this._e) {
3557+
return;
3558+
}
3559+
3560+
this.enable();
3561+
35353562
if (Glide.settings.autoplay) {
35363563
if (isUndefined(this._i)) {
35373564
this._i = setInterval(function () {
@@ -3564,15 +3591,15 @@ function Autoplay (Glide, Components, Events) {
35643591
bind: function bind() {
35653592
var _this2 = this;
35663593

3567-
Binder.on('mouseenter', Components.Html.root, function () {
3568-
_this2.stop();
3569-
3570-
Events.emit('autoplay.enter');
3594+
Binder.on('mouseover', Components.Html.root, function () {
3595+
if (_this2._e) {
3596+
_this2.stop();
3597+
}
35713598
});
3572-
Binder.on('mouseleave', Components.Html.root, function () {
3573-
_this2.start();
3574-
3575-
Events.emit('autoplay.leave');
3599+
Binder.on('mouseout', Components.Html.root, function () {
3600+
if (_this2._e) {
3601+
_this2.start();
3602+
}
35763603
});
35773604
},
35783605

@@ -3620,7 +3647,11 @@ function Autoplay (Glide, Components, Events) {
36203647
* - on updating via API to reset interval that may changed
36213648
*/
36223649

3623-
Events.on(['run.before', 'pause', 'destroy', 'swipe.start', 'update'], function () {
3650+
Events.on(['run.before', 'swipe.start', 'update'], function () {
3651+
Autoplay.stop();
3652+
});
3653+
Events.on(['pause', 'destroy'], function () {
3654+
Autoplay.disable();
36243655
Autoplay.stop();
36253656
});
36263657
/**
@@ -3630,7 +3661,18 @@ function Autoplay (Glide, Components, Events) {
36303661
* - while ending a swipe
36313662
*/
36323663

3633-
Events.on(['run.after', 'play', 'swipe.end'], function () {
3664+
Events.on(['run.after', 'swipe.end'], function () {
3665+
Autoplay.start();
3666+
});
3667+
/**
3668+
* Start autoplaying:
3669+
* - after each run, to restart autoplaying
3670+
* - on playing via API
3671+
* - while ending a swipe
3672+
*/
3673+
3674+
Events.on(['play'], function () {
3675+
Autoplay.enable();
36343676
Autoplay.start();
36353677
});
36363678
/**

dist/glide.js

+57-15
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@
17781778
* @return {Number}
17791779
*/
17801780
get: function get() {
1781-
return Components.Html.root.offsetWidth;
1781+
return Components.Html.track.offsetWidth;
17821782
}
17831783
});
17841784
define(Sizes, 'wrapperSize', {
@@ -2458,7 +2458,12 @@
24582458
*/
24592459
set: function set(value) {
24602460
var transform = mutator(Glide, Components).mutate(value);
2461-
Components.Html.wrapper.style.transform = "translate3d(".concat(-1 * transform, "px, 0px, 0px)");
2461+
var translate3d = "translate3d(".concat(-1 * transform, "px, 0px, 0px)");
2462+
Components.Html.wrapper.style.mozTransform = translate3d; // needed for supported Firefox 10-15
2463+
2464+
Components.Html.wrapper.style.webkitTransform = translate3d; // needed for supported Chrome 10-35, Safari 5.1-8, and Opera 15-22
2465+
2466+
Components.Html.wrapper.style.transform = translate3d;
24622467
},
24632468

24642469
/**
@@ -3083,8 +3088,6 @@
30833088
if (!detached) {
30843089
for (var i = 0; i < this.items.length; i++) {
30853090
this.items[i].draggable = false;
3086-
this.items[i].setAttribute('data-href', this.items[i].getAttribute('href'));
3087-
this.items[i].removeAttribute('href');
30883091
}
30893092

30903093
detached = true;
@@ -3104,7 +3107,6 @@
31043107
if (detached) {
31053108
for (var i = 0; i < this.items.length; i++) {
31063109
this.items[i].draggable = true;
3107-
this.items[i].setAttribute('href', this.items[i].getAttribute('data-href'));
31083110
}
31093111

31103112
detached = false;
@@ -3522,13 +3524,32 @@
35223524
* @return {Void}
35233525
*/
35243526
mount: function mount() {
3527+
this.enable();
35253528
this.start();
35263529

35273530
if (Glide.settings.hoverpause) {
35283531
this.bind();
35293532
}
35303533
},
35313534

3535+
/**
3536+
* Enables autoplaying
3537+
*
3538+
* @returns {Void}
3539+
*/
3540+
enable: function enable() {
3541+
this._e = true;
3542+
},
3543+
3544+
/**
3545+
* Disables autoplaying.
3546+
*
3547+
* @returns {Void}
3548+
*/
3549+
disable: function disable() {
3550+
this._e = false;
3551+
},
3552+
35323553
/**
35333554
* Starts autoplaying in configured interval.
35343555
*
@@ -3538,6 +3559,12 @@
35383559
start: function start() {
35393560
var _this = this;
35403561

3562+
if (!this._e) {
3563+
return;
3564+
}
3565+
3566+
this.enable();
3567+
35413568
if (Glide.settings.autoplay) {
35423569
if (isUndefined(this._i)) {
35433570
this._i = setInterval(function () {
@@ -3570,15 +3597,15 @@
35703597
bind: function bind() {
35713598
var _this2 = this;
35723599

3573-
Binder.on('mouseenter', Components.Html.root, function () {
3574-
_this2.stop();
3575-
3576-
Events.emit('autoplay.enter');
3600+
Binder.on('mouseover', Components.Html.root, function () {
3601+
if (_this2._e) {
3602+
_this2.stop();
3603+
}
35773604
});
3578-
Binder.on('mouseleave', Components.Html.root, function () {
3579-
_this2.start();
3580-
3581-
Events.emit('autoplay.leave');
3605+
Binder.on('mouseout', Components.Html.root, function () {
3606+
if (_this2._e) {
3607+
_this2.start();
3608+
}
35823609
});
35833610
},
35843611

@@ -3626,7 +3653,11 @@
36263653
* - on updating via API to reset interval that may changed
36273654
*/
36283655

3629-
Events.on(['run.before', 'pause', 'destroy', 'swipe.start', 'update'], function () {
3656+
Events.on(['run.before', 'swipe.start', 'update'], function () {
3657+
Autoplay.stop();
3658+
});
3659+
Events.on(['pause', 'destroy'], function () {
3660+
Autoplay.disable();
36303661
Autoplay.stop();
36313662
});
36323663
/**
@@ -3636,7 +3667,18 @@
36363667
* - while ending a swipe
36373668
*/
36383669

3639-
Events.on(['run.after', 'play', 'swipe.end'], function () {
3670+
Events.on(['run.after', 'swipe.end'], function () {
3671+
Autoplay.start();
3672+
});
3673+
/**
3674+
* Start autoplaying:
3675+
* - after each run, to restart autoplaying
3676+
* - on playing via API
3677+
* - while ending a swipe
3678+
*/
3679+
3680+
Events.on(['play'], function () {
3681+
Autoplay.enable();
36403682
Autoplay.start();
36413683
});
36423684
/**

0 commit comments

Comments
 (0)