jquery - only close tooltip if mouse is not over target or tooltip -
using jquery ui tooltip, keep tooltip open if i'm on target, or if i'm on tooltip itself.
i'm thinking can use close callback see if i'm on tooltip or target area, although have assign mouseout function.
here's jsfiddle: http://jsfiddle.net/handyman/fnjff/
------------- html ----------------------
<div id="target"> <a href="#" class="target">hover on me!</a> <a href="#" class="target">hover on me too!</a> </div>
------------ javascript -----------------
$(function() { $('#target').tooltip({ items: 'a.target', content: 'just text browse around in' }); });
i'm working through see can come with.
here solution came after searching , testing: http://jsfiddle.net/handyman/fnjff/11/
------------------- html --------------------
<body> <div id="target"> <a href="#" class="target">hover on me!</a> <a href="#" class="target">hover on me too!</a> </div> </body>
---------------- javascript -----------------
$('#target').tooltip({ items: 'a.target', content: 'loading…', show: null, // show open: function(event, ui) { if (typeof(event.originalevent) === 'undefined') { return false; } var $id = $(ui.tooltip).attr('id'); // close lingering tooltips $('div.ui-tooltip').not('#' + $id).remove(); // ajax function pull in data , add tooltip goes here }, close: function(event, ui) { ui.tooltip.hover(function() { $(this).stop(true).fadeto(400, 1); }, function() { $(this).fadeout('400', function() { $(this).remove(); }); }); } });
i having problem lingering tooltips when there bunch of tooltip links in close proximity, tooltips end stacking or not closing @ all, closes other open tooltips when tooltip opened.
Comments
Post a Comment