EasyUI Forum
April 28, 2024, 07:30:41 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to make tooltip click to show and click to hide  (Read 5540 times)
James
Jr. Member
**
Posts: 52


View Profile Email
« on: April 29, 2020, 08:11:14 AM »

tooltip can not set show and hide use same set
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: April 30, 2020, 01:18:12 AM »

You can set the 'showEvent' and 'hideEvent' to trigger the tooltip to display or hide on some events.
Code:
$('#tt').tooltip({
  showEvent: 'click'
});
Logged
James
Jr. Member
**
Posts: 52


View Profile Email
« Reply #2 on: April 30, 2020, 11:08:58 PM »

You can set the 'showEvent' and 'hideEvent' to trigger the tooltip to display or hide on some events.
Code:
$('#tt').tooltip({
  showEvent: 'click'
});
if you set like
Code:
$('#tt').tooltip({
  showEvent: 'click',
  hideEvent: 'click'
});
then the tooltip will never show
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: May 02, 2020, 06:19:32 PM »

This is the code to fix this issue. Please put it to the page.
Code:
(function($){
var hideMethod = $.fn.tooltip.methods.hide;
$.extend($.fn.tooltip.methods, {
hide: function(jq, e){
return jq.each(function(){
var tip = $(this).data('tooltip').tip;
if (tip && tip.is(':visible')){
hideMethod.call($(this),$(this),e);
}
})
}
})
})(jQuery);
Logged
James
Jr. Member
**
Posts: 52


View Profile Email
« Reply #4 on: May 03, 2020, 06:20:11 AM »

This is the code to fix this issue. Please put it to the page.
Code:
(function($){
var hideMethod = $.fn.tooltip.methods.hide;
$.extend($.fn.tooltip.methods, {
hide: function(jq, e){
return jq.each(function(){
var tip = $(this).data('tooltip').tip;  // Cannot read property 'tip' of undefined
if (tip && tip.is(':visible')){
hideMethod.call($(this),$(this),e);
}
})
}
})
})(jQuery);
Logged
James
Jr. Member
**
Posts: 52


View Profile Email
« Reply #5 on: May 03, 2020, 06:25:18 AM »

it seems also works on validatebox message tip, but which is not needed

Logged
James
Jr. Member
**
Posts: 52


View Profile Email
« Reply #6 on: May 03, 2020, 06:27:01 AM »

Code:
(function ($) {
    var hideMethod = $.fn.tooltip.methods.hide;
    $.extend($.fn.tooltip.methods, {
        hide: function (jq, e) {
            if (e) {
                return jq.each(function () {
                    console.info($(this).data());
                    var tip = $(this).data('tooltip').tip;
                    if (tip && tip.is(':visible')) {
                        hideMethod.call($(this), $(this), e);
                    }
                });
            }
        }
    });
})(jQuery);

is this ok?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #7 on: May 06, 2020, 11:42:40 PM »

Please look at this example http://code.reloado.com/uciquy3/edit#html. It works fine.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!