I want to show a tooltip which will disappear after 3 seconds time.
How should I modify my code? seems commented code will not work:
http://jsfiddle.net/sMJ2T/1/
HTML
<div id="mytooltip" title="the message"></div>
JS
$(function() {
$('#mytooltip').tooltip();
$('#mytooltip').tooltip({
open: function(e,o){
$(o.tooltip).mouseover(function(e){
$('#mytooltip').tooltip('close');
});
$(o.tooltip).mouseout(function(e){
});
},
close: function(e,o) {},
show: { duration: 800 }
});
$('#mytooltip').tooltip('open');//.delay(2000).tooltip('close');
});
You can do it like this:
$(function () {
$('#mytooltip').tooltip();
$('#mytooltip').tooltip({
open: function (e, o) {
$(o.tooltip).mouseover(function (e) {
$('#mytooltip').tooltip('close');
});
$(o.tooltip).mouseout(function (e) {});
},
close: function (e, o) {},
show: {
duration: 800
}
});
$('#mytooltip').tooltip('open');
setTimeout(function () {
$('#mytooltip').tooltip('close'); //close the tooltip
}, 3000); //but invoke me after 3 secs
});
Fiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With