Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add afterError callback #379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/featherlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
afterOpen: $.noop, /* Called after open. Gets event as parameter, this contains all data */
afterContent: $.noop, /* Called after content is ready and has been set. Gets event as parameter, this contains all data */
afterClose: $.noop, /* Called after close. Gets event as parameter, this contains all data */
afterError: $.noop, /* Called after an error loading content. Gets event as parameter, this contains all data */
onKeyUp: $.noop, /* Called on key up for the frontmost featherlight */
onResize: $.noop, /* Called after new content and when a window is resized */
type: null, /* Specify type of lightbox. If unset, it will check for the targetAttrs value. */
Expand Down Expand Up @@ -290,7 +291,8 @@
})
.then(self.$instance.promise())
/* Call afterOpen after fadeIn is done */
.done(function(){ self.afterOpen(event); });
.done(function(){ self.afterOpen(event); })
.fail(function(){ self.afterError(event); });
}
}
self.$instance.detach();
Expand Down Expand Up @@ -424,7 +426,7 @@
}
},

functionAttributes: ['beforeOpen', 'afterOpen', 'beforeContent', 'afterContent', 'beforeClose', 'afterClose'],
functionAttributes: ['beforeOpen', 'afterOpen', 'beforeContent', 'afterContent', 'beforeClose', 'afterClose', 'afterError'],

/*** class methods ***/
/* read element's attributes starting with data-featherlight- */
Expand Down