开发者

jQuery tooltip, hide after.. time

开发者 https://www.devze.com 2023-01-03 15:20 出处:网络
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?

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 :)


After that code put

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


have you tried delay?

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


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');
    }
);


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>


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);
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消