jQuery BlockUi Message after another

不羁的心 提交于 2019-12-19 03:45:11

问题


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.

Something like:

  1. message: 'hello world!'
  2. message: 'hello galaxy!'
  3. message: 'hello universe!'

how do I do this with jQuery BlockUI?


回答1:


Just create a div in your page like this:

<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, e.g.:

#blockMessage { font-weight: bold; }



回答2:


This does not work when you have some callback function is being called on onBlock or onUnBlock, for example like this:

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

An alternative to this would be, just call blockUI again with a different message:

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



来源:https://stackoverflow.com/questions/2027655/jquery-blockui-message-after-another

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