最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to set display time of ToastMessage? - Stack Overflow

programmeradmin1浏览0评论
  setTimeout(function () { showToastMessage("Guest added successfully test2").fadeOut(4000);});

I want to display this message up to 5 sec. but i don't know how to set the display time. I know how to set the delay time. i have used .fade Out method but its not working. i am still in trouble. help me

I want to display this message up to 5 sec. but i don't know how to set the display time. I know how to set the delay time. i have used .fade Out method but its not working. i am still in trouble. help me

  setTimeout(function () { showToastMessage("Guest added successfully test2").fadeOut(4000);});

I want to display this message up to 5 sec. but i don't know how to set the display time. I know how to set the delay time. i have used .fade Out method but its not working. i am still in trouble. help me

I want to display this message up to 5 sec. but i don't know how to set the display time. I know how to set the delay time. i have used .fade Out method but its not working. i am still in trouble. help me

Share Improve this question asked Oct 10, 2013 at 13:10 R K SharmaR K Sharma 8759 gold badges23 silver badges43 bronze badges 1
  • i am using this in jquery Mobile project – R K Sharma Commented Oct 10, 2013 at 13:14
Add a ment  | 

2 Answers 2

Reset to default 3

You can customise the JQuery toaster as you want, it to be.

Not just the time but the look and feel as well, by passing toaster settings as below

$.toaster({ settings : {...} });

For example to set the timeout property you can pass below argument,

$.toaster({ settings : {'timeout': 5000} });

This setting just need to be done only once.You can change the settings at any moment.

Or you can clear all custom changes and revert to the default settings as below

$.toaster.reset();

For other settings options you can visit this link.

I don't know how work showToastMessage function, but it's looks like this function return jQuery object, so you can use .delay method

showToastMessage("Guest added successfully test2")
    .delay(5000)
    .fadeOut(4000);

or without jQuery magic you can save jQuery toast object and call fadeOut after timeout

var $toast = showToastMessage("Guest added successfully test2");
setTimeout(function(){
    $toast.fadeOut(4000);
}, 5000);
发布评论

评论列表(0)

  1. 暂无评论