Skip to content

Commit 35ad207

Browse files
committed
Add ability to set animations function for individual nmObj. #fix 122
Add domCopy commentary
1 parent bb67c0e commit 35ad207

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

js/jquery.nyroModal.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jQuery(function($, undefined) {
1313
_nmObj = {
1414
filters: [], // List of filters used
1515
callbacks: {}, // Sepcific callbacks
16+
anims: {}, // Sepcific animations functions
1617
loadFilter: undefined, // Name of the filter used for loading
1718

1819
modal: false, // Indicates if it's a modal window or not
@@ -35,7 +36,7 @@ jQuery(function($, undefined) {
3536
ltr: true, // Left to Right by default. Put to false for Hebrew or Right to Left language. Used in gallery filter
3637

3738
// Specific confirguation for DOM filter
38-
domCopy: false,
39+
domCopy: false, // Indicates if DOM element should be copied or moved
3940

4041
// Specific confirguation for image filter
4142
imageRegex: '[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$', // Regex used to detect image link
@@ -383,10 +384,15 @@ jQuery(function($, undefined) {
383384
if (!this._animated) {
384385
this._animated = true;
385386
if (!$.isFunction(clb)) clb = $.noop;
386-
var set = this.anim[fct] || this.anim.def || 'basic';
387-
if (!_animations[set] || !_animations[set][fct] || !$.isFunction(_animations[set][fct]))
388-
set = 'basic';
389-
_animations[set][fct](this, $.proxy(function() {
387+
if (this.anims[fct] && $.isFunction(this.anims[fct])) {
388+
curFct = this.anims[fct];
389+
} else {
390+
var set = this.anim[fct] || this.anim.def || 'basic';
391+
if (!_animations[set] || !_animations[set][fct] || !$.isFunction(_animations[set][fct]))
392+
set = 'basic';
393+
curFct = _animations[set][fct];
394+
}
395+
curFct(this, $.proxy(function() {
390396
this._animated = false;
391397
this._callFilters('after'+ucfirst(fct));
392398
clb();

0 commit comments

Comments
 (0)