快讯
在屏幕上显示浮动的闪存消息。
显示加载
<p data-control="flash-message" data-interval="5" class="success">
This message is created from a static element. It will go away in 5 seconds.
</p>
This message is created from a static element. It will go away in 5 seconds.
Trigger
<p>
<a href="#" class="btn btn-primary" onclick="$.wn.flashMsg({text: 'The record has been successfully saved. This message will go away in 1 second.', 'class': 'success', 'interval': 1}); return false;">
Show Success
</a>
<a href="javascript:;" class="btn btn-danger" onclick="$.wn.flashMsg({text: 'Babam!', 'class': 'error'}); return false;">
Show Error
</a>
<a href="javascript:;" class="btn btn-warning" onclick="$.wn.flashMsg({text: 'Warning! Winter is too good for this world!', 'class': 'warning'}); return false;">
Show Warning
</a>
</p>
显示静态
通过附加static
班级。这data-control
不需要属性。
<p class="flash-message static success">
Import completed successfully (success)
</p>
<p class="flash-message static info">
Informative info box is informational (info)
</p>
<p class="flash-message static warning">
Phasers have been set to stun (warning)
</p>
<p class="flash-message static error">
We couldn't help you with that (error)
</p>
数据属性
- data-control="flash-message" - 启用 flash 消息插件
- data-interval="2" - 以秒为单位显示消息的间隔,可选。默认值:2
JavaScript API
$.wn.flashMsg({
'text': 'Record saved.',
'class': 'success',
'interval': 3
})