From e5fc08d1f6ed0e9aff72155034da43845a28dde4 Mon Sep 17 00:00:00 2001 From: Bluety Date: Fri, 4 Sep 2015 11:50:10 +0200 Subject: [PATCH] Fix JS error emulateTransitionEnd is not a function The function must be declared before use. --- jquery.smartbanner.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/jquery.smartbanner.js b/jquery.smartbanner.js index e9bd32b..126c337 100644 --- a/jquery.smartbanner.js +++ b/jquery.smartbanner.js @@ -4,6 +4,20 @@ * Based on 'jQuery Smart Web App Banner' by Kurt Zenisek @ kzeni.com */ !function ($) { + + // http://blog.alexmaccaw.com/css-transitions + $.fn.emulateTransitionEnd = function(duration) { + var called = false, $el = this + $(this).one($.support.transition.end, function() { + called = true + }) + var callback = function() { + if (!called) $($el).trigger($.support.transition.end) + } + setTimeout(callback, duration) + return this + } + var SmartBanner = function (options) { this.origHtmlMargin = parseFloat($('html').css('margin-top')) // Get the original margin-top of the HTML element so we can take that into account this.options = $.extend({}, $.smartbanner.defaults, options) @@ -306,20 +320,7 @@ if ($.support.transition !== undefined) return // Prevent conflict with Twitter Bootstrap - - // http://blog.alexmaccaw.com/css-transitions - $.fn.emulateTransitionEnd = function(duration) { - var called = false, $el = this - $(this).one($.support.transition.end, function() { - called = true - }) - var callback = function() { - if (!called) $($el).trigger($.support.transition.end) - } - setTimeout(callback, duration) - return this - } - + $(function() { $.support.transition = transitionEnd() })