Skip to content

Instantly share code, notes, and snippets.

@tcarlsen
Created April 11, 2014 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcarlsen/10458485 to your computer and use it in GitHub Desktop.
Save tcarlsen/10458485 to your computer and use it in GitHub Desktop.
function openBubble(id) {
left = $('#' + id).css('left');
top = $('#' + id).css('top');
width = $('#' + id).outerWidth();
height = $('#' + id).outerHeight();
lastOpenId = id;
$('#' + id)
.animate({
'left': '261px',
'top': '120px'
}, 200, 'easeOutExpo')
.delay(200)
.animate({
'width': '400px',
'height': '400px'
}, 200, 'easeOutExpo', function () {
$('.smsInner')
.css({
'display': 'inline'
});
pushBubble(id);
$('.clickBubble').unbind();
closeBubble();
});
}
clickBubble = function () {
$('.clickBubble')
.bind('click', function (e) {
e.preventDefault();
name = $(this).attr('id');
openBubble(name);
});
};
clickBubble();
closeBubble = function () {
$('.bubble, .smsInner')
.bind('click', function (e) {
e.preventDefault();
var id = $(this).attr('id');
$('.smsInner')
.css({
'display': 'none'
});
$('#' + lastOpenId)
.stop()
.animate({
'left': left,
'top': top,
'width': width,
'height': height
}, 100, 'easeOutExpo', function () {
$('.clickBubble, .smsInner').unbind();
if (id !== undefined && id !== lastOpenId) {
openBubble(id);
} else {
clickBubble();
}
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment