Skip to content

Commit e4bd887

Browse files
committed
Add onOpenComplete event
1 parent 5d2e3d4 commit e4bd887

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/js/jBox.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ declare namespace jBox {
197197
/** Fired when jBox opens */
198198
onOpen?: () => void;
199199

200+
/** Fired when jBox is completely open (when fading is finished) */
201+
onCloseComplete?: () => void;
202+
200203
/** Fired when jBox closes */
201204
onClose?: () => void;
202205

src/js/jBox.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ function jBoxWrapper(jQuery) {
135135
onPosition: null, // Fired when jBox is positioned
136136
onCreated: null, // Fired when jBox is created and availible in DOM
137137
onOpen: null, // Fired when jBox opens
138+
onOpenComplete: null, // Fired when jBox is completely open (when fading is finished)
138139
onClose: null, // Fired when jBox closes
139140
onCloseComplete: null, // Fired when jBox is completely closed (when fading is finished)
140141
onDragStart: null, // Fired when dragging starts
@@ -798,6 +799,7 @@ function jBoxWrapper(jQuery) {
798799
var translate = position ? item[1].replace('%XY', this._getXY(position).toUpperCase()) : item[1];
799800
animations[this.options.animation[ev]].positions && (translate = translate.replace('%V', animations[this.options.animation[ev]].positions[position][item[0]]));
800801
keyframe_css += item[0] + ' {transform:' + translate + ';}';
802+
801803
}.bind(this));
802804
keyframe_css += '}';
803805

@@ -1744,6 +1746,9 @@ function jBoxWrapper(jQuery) {
17441746
this.isOpening = true;
17451747
this.wrapper.css({display: 'block'});
17461748
}.bind(this),
1749+
complete: function () {
1750+
this._fireEvent('onOpenComplete');
1751+
}.bind(this),
17471752
always: function () {
17481753
this.isOpening = false;
17491754

@@ -1754,6 +1759,7 @@ function jBoxWrapper(jQuery) {
17541759
} else {
17551760
this.wrapper.css({display: 'block', opacity: 1});
17561761
this.positionOnFadeComplete && this.position() && (this.positionOnFadeComplete = false);
1762+
this._fireEvent('onOpenComplete');
17571763
}
17581764
}
17591765
}.bind(this);

0 commit comments

Comments
 (0)