jQuery Undo 介绍
This plugin provides a global undo utility.
You can add undo items to the stack with:
$.undo(callback, target, message)
Where the callback function kNows how to perform the actual undo-ing when
executed. This will automatically display the message (or a default one
created if that parameter is absent) and an “Undo” link within items matching
the ‘.undo’ selector (which is customizable by setting $.undo.notice.selector.
If no action is taken within 60 seconds, this message is hidden. If the “Undo”
link is clicked or you manually call:
$.undo()
then the plugin will execute the callback function (passing in the target as
the parameter, if a target was provided).
If you simply create an empty
in your page and startadding undo functions to $.undo(undoAction), things should “just work” as
described above. If you want more explicit control of the displayed messages,
there are a variety of settings and functions you can alter in $.undo.notice
that can help you customize the behavior or plug
the functionality into your own custom markup.
To enable the use of Ctrl-z to trigger undo execution, you can call:
$.undo.supportsCtrlz(true)
By default this is disabled.
The recommended CSS for the classes involved is:
.undo { background: #FFF1A8; color: black; display: none; font-size: 85%; font-weight: bold; margin:3px 0px;; padding: 5px 15px; text-align: center; } .undo-message { text-align: center; } a.undo-execute { color: blue; padding: 0px 2px 0px 10px; } a.undo-cancel { font-size: 80%; text-decoration: none; vertical-align: center; }
jQuery Undo 官网
http://plugins.jquery.com/project/undo
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。