Difference between revisions of "Team:UCL/Bactoman1"
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{CSS_UCL6}} | {{CSS_UCL6}} | ||
+ | |||
<html> | <html> | ||
+ | <head> | ||
+ | |||
+ | <script> | ||
+ | |||
+ | $(function () { | ||
+ | $('.content').myTooltip({ | ||
+ | speed: 200, | ||
+ | closeOnClick: true | ||
+ | }); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
− | + | $.fn.myTooltip = function ( options ) { | |
+ | |||
+ | |||
+ | var defaults = { | ||
+ | speed: 650, | ||
+ | closeOnClick: false, | ||
+ | tooltipClass: 'tooltip' | ||
+ | }; | ||
+ | |||
+ | var settings = $.extend( {}, defaults, options ); | ||
+ | |||
+ | var $this = $(this), | ||
+ | $tooltip = $this.find('.'+settings.tooltipClass); | ||
+ | |||
+ | |||
+ | setPosition(); | ||
+ | $(window).resize(function () { | ||
+ | setPosition(); | ||
+ | }); | ||
+ | |||
+ | |||
+ | $this.mouseenter(function () { | ||
+ | $('.'+settings.tooltipClass, this).fadeIn(settings.speed); | ||
+ | }).mouseleave(function () { | ||
+ | $('.'+settings.tooltipClass, this).stop(true, true).fadeOut(settings.speed); | ||
+ | }); | ||
+ | |||
+ | if(settings.closeOnClick) { | ||
+ | $tooltip.click(function () { | ||
+ | $(this).stop(true, true).fadeOut(settings.speed); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | function setPosition() { | ||
+ | $tooltip.css({top: $this.height(), left: -150}); | ||
+ | } | ||
+ | |||
+ | }; | ||
− | < | + | </script> |
− | <img src="https://static.igem.org/mediawiki/2015/8/8d/UCLbactoman1.png" width=" | + | <img src="https://static.igem.org/mediawiki/2015/8/8d/UCLbactoman1.png" height="42 width="42"> |
</div> | </div> |
Latest revision as of 01:33, 19 September 2015
'