jQuery tooltip, hide after.. time

南笙酒味 提交于 2019-12-04 06:01:03

问题


I'm using the Flowplayer.org Tooltips and I'd like it to disappear after 4 seconds.

Here's the code for it, can anyone help?

$("#search").tooltip({ offset: [45, 170], effect: 'slide' });

Thanks :)


回答1:


Edit. Borrowed this from another Stack overflow question. It works here: http://jsfiddle.net/mmRu2/

jQuery.fn.delay = function(time,func){
    return this.each(function(){
        setTimeout(func,time);
    });
};

$('#search').delay(2000, function(){
    $('#search').fadeOut('fast');
    }
);



回答2:


After that code put

setTimeout(function() {
    $(".tooltip").fadeOut("slow");
}, 4000);



回答3:


have you tried delay?

$("#search").tooltip({ offset: [45, 170], delay: 4000, effect: 'slide' });



回答4:


None of these answers worked for me. Jamal got close, but missed the important parts.

Working code to hide a tooltip after 4seconds:

<script>
$("s.howTooltip").tooltip({
  //start when the tooltip is shown
  onShow: function () {
    //store a reference to this
    var self = this;
    //start a timeout for 4seconds
    setTimeout(function () {
      //get a reference to the tooltip and hide it.
      self.getTip().hide();
    }, 4000)
  }
})
</script>



回答5:


try the following callback... hope it will work... but i will fade to opacity 0.8... u can change the rest...

onShow: function() {
        this.getTrigger().fadeTo("slow", 0.8);
    }


来源:https://stackoverflow.com/questions/3020998/jquery-tooltip-hide-after-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!