首页 > Web开发 > 详细

jQuery通知查件noty

时间:2014-02-05 22:07:46      阅读:830      评论:0      收藏:0      [点我收藏+]

jQuery 通知查件noty 简单使用

官方:http://ned.im/noty/

 

其它查件推荐

NotifIt

Demo http://js.itivy.com/jiaoben1852/index.html.  这个插件也不错 目前未找到官方网址  不过Down下这个Demo也可以的 所需文件是jquery.js  notifIt.js  zzsc.css 在notifIt.js中有通知显示时间的设定。缺点:通知一次只能弹出一个 稍作修改后应该也很好的。

 

回到刚才的话题 本插件需要jquery.jnotify.css  jquery.jnotify.js  以及jQuery和jquery.ui

通知显示时间在jquery.jnotify.js的62行可以看到

 

官方Demo已经写得很清楚了 这里就是copy一下

bubuko.com,布布扣
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css"
        rel="stylesheet" type="text/css" />
    <link href="jquery.jnotify.css" rel="stylesheet" type="text/css" />

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script>

    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"
        type="text/javascript"></script>

    <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>


    <script src="jquery.jnotify.js" type="text/javascript"></script>

    <script type="text/javascript">
        jQuery(function($) {
            var $themeswitcher = $(.ui-themeswitcher);
            if ($themeswitcher.themeswitcher) {
                $themeswitcher.themeswitcher();
            }
            else {
                $themeswitcher.before(<div class="ui-widget" style="margin-bottom: 0.5em">
                                + <div class="ui-state-error ui-corner-all" style="padding:0.3em;">
                                    + <span class="ui-icon ui-icon-alert" style="float:left;margin-right:0.3em"></span>
                                    + Unable to load ThemeSwitcher from jqueryui.com
                                + </div>
                            + </div>);
            }
        });
    </script>

</head>
<body>
    <div id="Notification">
    </div>
    <h1>
        jNotify (JQuery Notification Engine)</h1>
    <div class="ui-themeswitcher">
    </div>
    <br />
    <div id="StatusBar" style="height: 20px;">
    </div>
    <br />
    <button id="addStatusBarMessage">
        Add a non permanent message (Status Bar)</button>
    <br />
    <button id="addStatusBarError">
        Add a permanent error (Status Bar)</button>
    <br />
    <br />
    <button id="addNotificationMessage">
        Add a non permanent message (Notification)</button>
    <br />
    <button id="addNotificationError">
        Add a permanent error (Notification)</button>

    <script type="text/javascript">
        $(document).ready(function() {

            // For jNotify Inizialization
            // Parameter:
            // oneAtTime : true if you want show only one message for time
            // appendType: ‘prepend‘ if you want to add message on the top of stack, ‘append‘ otherwise
            $(#StatusBar).jnotifyInizialize({
                oneAtTime: true
            })
            $(#Notification)
                .jnotifyInizialize({
                    oneAtTime: false,
                    appendType: append
                })
                .css({ position: absolute,
                    marginTop: 20px,
                    right: 20px,
                    width: 250px,
                    z-index: 9999
                });
            // --------------------------------------------------------------------------

            // For add a notification on button click
            // Parameter:
            // text: Html do you want to show
            // type: ‘message‘ or ‘error‘
            // permanent: True if you want to make a message permanent
            // disappearTime: Time spent before closing message
            $(#addStatusBarMessage).click(function() {
                $(#StatusBar).jnotifyAddMessage({
                    text: This is a non permanent message.,
                    permanent: false,
                    showIcon: false
                });
            });

            $(#addStatusBarError).click(function() {
                $(#StatusBar).jnotifyAddMessage({
                    text: This is a permanent error.,
                    permanent: true,
                    type: error
                });
            });

            $(#addNotificationMessage).click(function() {
                $(#Notification).jnotifyAddMessage({
                    text: This is a non permanent message.,
                    permanent: false
                });
            });

            $(#addNotificationError).click(function() {
                $(#Notification).jnotifyAddMessage({
                    text: This is a permanent error.,
                    permanent: true,
                    type: error
                });
            });
            // -----------------------------------------------------
        });
    </script>

</body>
</html>
bubuko.com,布布扣

jQuery通知查件noty

原文:http://www.cnblogs.com/cart55free99/p/3538346.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!