简体   繁体   English

jQuery BlockUi消息接连不断

[英]jQuery BlockUi Message after another

I'm using jQuery BlockUI plugin, and i have been able to sucessfully show a single message in the page, however... let's say that I want to show 3 messages , one after another. 我正在使用jQuery BlockUI插件,并且我已经能够成功地在页面中显示单个消息,但是...让我们说我想要一个接一个地显示3条消息。

Something like: 就像是:

  1. message: 'hello world!' 消息:'你好世界!'
  2. message: 'hello galaxy!' 消息:'你好星系!'
  3. message: 'hello universe!' 消息:'你好宇宙!'

how do I do this with jQuery BlockUI? 我如何使用jQuery BlockUI执行此操作?

Just create a div in your page like this: 只需在页面中创建一个div,如下所示:

<div id="blockMessage"></div>

And for the script... 对于剧本......

$.blockUI({ message: $('#blockMessage') });
$("#blockMessage").html('Hello World!');
$("#blockMessage").html('Hello Galaxy!');
$("#blockMessage").html('Hello Universe!);
$.unblockUI();

This goes by very fast, but you get the idea....bonus here is you can style it to look however you want as well, eg: 这个过程非常快,但你明白了......这里的奖励是你可以将它设计成你想要的样子,例如:

#blockMessage { font-weight: bold; }

This does not work when you have some callback function is being called on onBlock or onUnBlock, for example like this: 当你在onBlock或onUnBlock上调用一些回调函数时,这不起作用,例如:

$.blockUI({ message : 'your new message', onBlock : callbackFunction }); $ .blockUI({message:'your new message',onBlock:callbackFunction});

An alternative to this would be, just call blockUI again with a different message: 另一种方法是,只需使用不同的消息再次调用blockUI:

$.blockUI({ message: 'New message' }); $ .blockUI({message:'New message'});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM