Skip to content

Commit

Permalink
Merge pull request #16 from everdimension/optional_arguments_fix
Browse files Browse the repository at this point in the history
Determine callback and options arguments first
  • Loading branch information
chinchang committed Oct 31, 2015
2 parents e5ed929 + 29197cb commit 3763db3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/cta.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
};

function cta(trigger, target, options, callback) {
// Support optional arguments
if (typeof options === 'function') {
callback = options;
options = {};
}

if (!isSupportedBrowser) {
if (callback) {
callback(target);
Expand All @@ -100,11 +106,6 @@
dummy,
extraTransitionDuration = 1;

// Support optional arguments
if (typeof options === 'function') {
callback = options;
options = {};
}
options = options || {};
options.duration = options.duration || defaults.duration;
options.targetShowDuration = options.targetShowDuration || getAnimationTime(target) || defaults.targetShowDuration;
Expand Down

0 comments on commit 3763db3

Please sign in to comment.