Created
May 15, 2014 10:58
-
-
Save lnked/319a3bbe84510024e2ef 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
$(".tooltip-trigger").on('mouseenter', function (e) { | |
var $block = $(this).closest('.tooltip-container'); | |
if( !$block.hasClass('awards_icon-disabled') ) | |
{ | |
if( $block.find('.tooltip').length == 0 ) | |
{ | |
var tooltip = $(this).data('tooltip'); | |
if( typeof tooltip !== 'undefined' && tooltip !== '' ) | |
{ | |
$block.append( | |
[ | |
'<div class="tooltip">', | |
tooltip, | |
'</div>' | |
].join('') | |
); | |
} | |
} | |
if( $block.hasClass('tooltip-green') ) | |
{ | |
var ml = Math.floor( $block.find('.tooltip').innerWidth() /2 ); | |
if( $(this).closest('.profile_awards_honors').length > 0 ) | |
{ | |
ml += 12 ; | |
} | |
else | |
{ | |
ml += 20 ; | |
} | |
$block | |
.find('.tooltip') | |
.css({ | |
'display': 'block', | |
'opacity': 0, | |
'margin-bottom': "32px", | |
'margin-left': '-' + ml + 'px' | |
}) | |
.stop() | |
.animate({ 'opacity': 1, 'margin-bottom': '18px' }, 300); | |
} | |
else | |
{ | |
$block | |
.find('.tooltip') | |
.css({ | |
'display': 'block', | |
'opacity': 0, | |
'margin-top': "32px" | |
}) | |
.stop() | |
.animate({ 'opacity': 1, 'margin-top': '16px' }, 300); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment