jquery tooltip, but on click instead of hover

后端 未结 3 640
傲寒
傲寒 2020-12-10 07:12

We were using \'title\' attributes to display something on mouseover. We want it now to display on a click. How can I get a floating box that looks like a title/tooltip, b

3条回答
  •  盖世英雄少女心
    2020-12-10 08:02

    If you feel like handcoding it, this should do the job:

    The html:

    
    
    
    

    And the JS:

    $('#yourLink').click(function(){
      $('#tooltip').toggle();
    });
    

    You just need to style correctly the tooltip div

    There are also nice tooltip plugins out there. iftrue mentioned one, there is also this one

提交回复
热议问题