Forked from anonymous/okay this time its the right one :D
Last active
November 15, 2016 20:15
-
-
Save Helfull/3ffa0b360ce69a9f28ff2deea00698d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chatbubble() { | |
var animationEnd = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend"; | |
var str = "OMG I just did a thing! and now holy shit is this even longer thing!"; | |
var x = str.length; | |
x = x * 50; | |
// Put in the text the supporter wants to say | |
$('#cbinntertext').html(str); | |
// show the bubble | |
$('#cb').show(); | |
// animate the bubble | |
// 1. Add the bounceIn | |
$('#cb').addClass('animated bounceIn').one(animationEnd, function() { | |
setTimeout(function() { | |
// After a set amount of time remove the BounceIn | |
$('#cb').removeClass('bounceIn'); | |
// and add the bounceOut | |
$('#cb').addClass('bounceOut').one(animationEnd, function() { | |
// once the bounceOut animation is finished | |
// hide the bubble and remove the animation classes | |
$('#cb').hide(); | |
$('#cb').removeClass('animated bounceOut'); | |
}); | |
}, x); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment