Skip to content

Instantly share code, notes, and snippets.

@moeproblems
Created December 15, 2010 23:46
Show Gist options
  • Save moeproblems/742795 to your computer and use it in GitHub Desktop.
Save moeproblems/742795 to your computer and use it in GitHub Desktop.
$('#mouseover-top').bind('mouseenter', function(e) {
var tab = that.tabs[that.settings.tab];
var elem = $('#' + that.settings.tab + '-box');
var $this = $(this);
$('#mouseover-bottom').show();
var speed = Math.abs(tab.top) / (tab.height - that.settings.height);
elem.stop().animate({top: 0}, Math.round(that.settings.maxSpeed * speed), function() {
$this.hide();
tab.top = 0;
});
}).bind('mouseleave', function(e) {
var tab = that.tabs[that.settings.tab];
var elem = $('#' + that.settings.tab + '-box');
elem.stop();
tab.top = Math.round(parseInt(elem.css('top').replace(/px/g, '')));
});
$('#mouseover-bottom').bind('mouseenter', function(e) {
var tab = that.tabs[that.settings.tab];
var elem = $('#' + that.settings.tab + '-box');
var $this = $(this);
$('#mouseover-top').show();
var speed = 1 - Math.abs(tab.top) / (tab.height - that.settings.height);
elem.stop().animate({top: (-1 * (tab.height - that.settings.height))}, Math.round(that.settings.maxSpeed * speed), function() {
$this.hide();
tab.top = elem.css('top');
});
}).bind('mouseleave', function(e) {
var tab = that.tabs[that.settings.tab];
var elem = $('#' + that.settings.tab + '-box');
elem.stop();
tab.top = Math.round(parseInt(elem.css('top').replace(/px/g, '')));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment