Skip to content

Commit 7badecd

Browse files
committed
Change and addition of event API.
1 parent 214fa87 commit 7badecd

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

src/js/animsition.js

+28-7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
overlayParentElement : 'body'
3131
}, options);
3232

33+
methods.settings = {
34+
events: {
35+
inStartLegacy: 'animsition.start', // Removed in v4.0
36+
inEndLegacy: 'animsition.end', // Removed in v4.0
37+
inStart: 'animsition.inStart',
38+
inEnd: 'animsition.inEnd',
39+
outStart: 'animsition.outStart',
40+
outEnd: 'animsition.outEnd'
41+
}
42+
};
43+
3344
// Remove the "Animsition" in a browser
3445
// that does not support the "animaition-duration".
3546
var support = methods.supportCheck.call(this, options);
@@ -188,14 +199,16 @@
188199
var $this = $(this);
189200

190201
$this
191-
.trigger('animsition.start')
192202
.css({ 'animation-duration' : (inDuration / 1000) + 's' })
193203
.addClass(inClass)
204+
.trigger(methods.settings.events.inStartLegacy) // Removed in v4.0
205+
.trigger(methods.settings.events.inStart)
194206
.animateCallback(function(){
195207
$this
196208
.removeClass(inClass)
197209
.css({ 'opacity' : 1 })
198-
.trigger('animsition.end');
210+
.trigger(methods.settings.events.inEndLegacy) // Removed in v4.0
211+
.trigger(methods.settings.events.inEnd);
199212
});
200213
},
201214

@@ -204,15 +217,18 @@
204217
var options = $this.data(namespace).options;
205218

206219
$this
207-
.trigger('animsition.start')
208-
.css({ 'opacity' : 1 });
220+
.css({ 'opacity' : 1 })
221+
.trigger(methods.settings.events.inStartLegacy) // Removed in v4.0
222+
.trigger(methods.settings.events.inStart);
209223

210224
$(options.overlayParentElement)
211225
.children('.' + options.overlayClass)
212226
.css({ 'animation-duration' : (inDuration / 1000) + 's' })
213227
.addClass(inClass)
214228
.animateCallback(function(){
215-
$this.trigger('animsition.end');
229+
$this
230+
.trigger(methods.settings.events.inEndLegacy) // Removed in v4.0
231+
.trigger(methods.settings.events.inEnd);
216232
});
217233
},
218234

@@ -244,11 +260,14 @@
244260
$this
245261
.css({ 'animation-duration' : ((outDuration + 1) / 1000) + 's' })
246262
.addClass(outClass)
263+
.trigger(methods.settings.events.outStart)
247264
.animateCallback(function(){
248-
location.href = url;
265+
$this.trigger(methods.settings.events.outEnd);
266+
window.location.href = url;
249267
});
250268
},
251269

270+
252271
pageOutOverlay: function(outClass,outDuration,url){
253272
var _this = this;
254273
var $this = $(this);
@@ -262,8 +281,10 @@
262281
.css({ 'animation-duration' : ((outDuration + 1) / 1000) + 's' })
263282
.removeClass(inClass)
264283
.addClass(outClass)
284+
.trigger(methods.settings.events.outStart)
265285
.animateCallback(function(){
266-
location.href = url;
286+
$this.trigger(methods.settings.events.outEnd);
287+
window.location.href = url;
267288
});
268289
},
269290

0 commit comments

Comments
 (0)