Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Fix JS error emulateTransitionEnd is not a function #102

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
29 changes: 15 additions & 14 deletions jquery.smartbanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
})
Expand Down