diff --git a/README.md b/README.md index 2b579fd..96de11c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ brings this feature to older iOS versions, Android devices and for Windows Store }, onClose: function() { // alert('Click close'); + }, + onShow: function() { + // alert('Banner shown'); } }) diff --git a/jquery.smartbanner.js b/jquery.smartbanner.js index e9bd32b..7af2f5e 100644 --- a/jquery.smartbanner.js +++ b/jquery.smartbanner.js @@ -74,6 +74,13 @@ this.options.onClose = function() {}; } + // Set default onClose callback if not set in options + if (typeof this.options.onShow === 'function') { + this.options.onShow = this.options.onShow; + } else { + this.options.onShow = function() {}; + } + // Create banner this.create() this.show() @@ -162,6 +169,7 @@ banner.slideDown(this.options.speedIn).addClass('shown'); } } + this.options.onShow(); } , hide: function(callback) {