设为首页收藏本站

Scripts 学盟

 找回密码
 加入学盟

QQ登录

只需一步,快速开始

查看: 2036|回复: 4
打印 上一主题 下一主题

自己练手的一个jquery消息提示插件 [复制链接]

Rank: 8Rank: 8

风雨相伴

跳转到指定楼层
1#
Snail 实名认证  发表于 2011-9-28 12:29:13 |只看该作者 |倒序浏览
本帖最后由 Snail 于 2011-10-28 17:56 编辑

看图:
fdsafd.jpg

jquery.message.css
  1. @charset "utf-8";

  2. #system-message {
  3.         margin-bottom: 10px;
  4.         padding-bottom: 0;
  5.         padding-left: 0;
  6.         padding-right: 0;
  7.         padding-top: 0;
  8. }

  9. #system-message dt {
  10.         display: none;
  11.         font-weight: bold;
  12. }

  13. #system-message dd {
  14.         font-weight: bold;
  15.         margin-bottom: 0;
  16.         margin-left: 0;
  17.         margin-right: 0;
  18.         margin-top: 0;
  19.         text-indent: 30px;
  20. }

  21. #system-message dd ul {
  22.         background-position: 4px top;
  23.         background-repeat: no-repeat;
  24.         border-bottom-color: #84A7DB;
  25.         border-bottom-style: solid;
  26.         border-bottom-width: 3px;
  27.         border-top-color: #84A7DB;
  28.         border-top-style: solid;
  29.         border-top-width: 3px;
  30.         color: #0055BB;
  31.         list-style-image: none;
  32.         list-style-position: outside;
  33.         list-style-type: none;
  34.         margin-bottom: 10px;
  35.         padding-bottom: 10px;
  36.         padding-left: 10px;
  37.         padding-right: 10px;
  38.         padding-top: 10px;
  39. }

  40. #system-message dd ul li {
  41.         line-height: 1.5em;
  42. }

  43. #system-message dd.message ul {
  44.         background-color: #C3D2E5;
  45.         background-image: url("../images/notice-info.png");
  46. }

  47. #system-message dd.error ul,#system-message dd.warning ul,#system-message dd.notice ul
  48.         {
  49.         color: #CC0000;
  50. }

  51. #system-message dd.error ul {
  52.         background-color: #E6C0C0;
  53.         background-image: url("../images/notice-alert.png");
  54.         border-bottom-color: #DE7A7B;
  55.         border-top-color: #DE7A7B;
  56. }

  57. #system-message dd.warning ul {
  58.         background-color: #E6C8A6;
  59.         background-image: url("../images/notice-note.png");
  60.         border-bottom-color: #FFBB00;
  61.         border-top-color: #FFBB00;
  62.         color: #CC0000;
  63. }

  64. #system-message dd.notice ul {
  65.         background-color: #EFE7B8;
  66.         background-image: url("../images/notice-note.png");
  67.         border-bottom-color: #F0DC7E;
  68.         border-top-color: #F0DC7E;
  69.         color: #CC0000;
  70. }

  71. /*=S 编辑器图片来源提示 */
  72. .editor_hint {
  73.         width: auto;
  74.         margin-bottom: 0px;
  75.         border: 1px solid #F8E8AB;
  76.         background-color: #FFF9E2;
  77.         color: #909188;
  78.         overflow: hidden;
  79.         position: relative;
  80.         min-height: 20px;
  81.         _height: 20px;
  82. }

  83. .editor_hint:after {
  84.         clear: both;
  85.         display: block;
  86.         content: ""
  87. }

  88. .editor_hint span {
  89.         text-indent: 0;
  90.         float: left
  91. }

  92. .editor_hint span a, /*.editor_hint a{color:#CE0201!important;}*/
  93.         .editor_hint span a:link,.editor_hint span a:active {
  94.         text-decoration: underline;
  95. }

  96. .editor_hint span a:hover,.editor_hint span a:visited {
  97.         text-decoration: underline;
  98. }

  99. .bt_hint_close {
  100.         font-family: verdana;
  101.         color: #D43A04;
  102.         font-weight: bold;
  103.         cursor: pointer;
  104.         font-size: 12px;
  105.         position: absolute;
  106.         right: 5px;
  107.         top: 6px;
  108. }

  109. .editor_hint_cont {
  110.         padding: 5px 15px 5px 5px;
  111. }

  112. .editor_hint_cont .icon_hint {
  113.         margin-right: 5px;
  114.         position: static;
  115. }

  116. /* 文本框加载 */
  117. .cg_loading {
  118.         background-image: url("../images/ajax_small.gif");
  119.         background-position: 100% 2px;
  120.         background-repeat: no-repeat;
  121.         background-color: #D5EEFF;
  122. }

  123. /* 文本框加载 */
  124. .cg_loading {
  125.         background-position: 100% 2px;
  126.         background-repeat: no-repeat;
  127.         background-color: #D5EEFF;
  128.         background-image: url("../images/loading.gif") ;
  129. }

  130. .ok_icon {
  131.         background-position: 100% 2px;
  132.         background-repeat: no-repeat;
  133.         background-color: #D5EEFF;
  134.         background-image: url("../images/accept.png");
  135. }

  136. .notok_icon {
  137.         background-position: 100% 2px;
  138.         background-repeat: no-repeat;
  139.         background-color: #D5EEFF;
  140.         background-image: url("../images/exclamation.png");
  141. }
复制代码
jquery.message.js
  1. /**
  2. *  type: Information reminder types; The rid_device_info: common information, error messages, warn as freely though they are: warning: the information
  3. *
  4. *  isVanish:  Whether timing hidden. Default automatic hidden
  5. *  vanish:         Disappear time, the default for 3 seconds (3000 milliseconds)
  6. *  content:  prompt message.
  7. *
  8. * @author wucc Created on 2011.07.13
  9. */
  10. (function($){
  11.     $.fn.message = function(options){
  12.         var defaults = {
  13.             type    :"info",// 信息提示类型;info:普通信息,error:错误信息,warn:警告信息
  14.                         isVanish:true, // 是否定时隐藏 默认自动隐藏
  15.                         vanish  :1500, // 消失时间 ,默认为1500毫秒)
  16.                         content :escape("提示信息")
  17.         }
  18.                 var div=$(this);
  19.         var options = $.extend(defaults, options);
  20.         this.each(function(){
  21.                         if('object' == typeof(options))
  22.                         {
  23.                                 var type = options.type.toLowerCase();
  24.                                 if(type == "info"){
  25.                                         var html ='<dl id="system-message"><dt class="message">消息</dt><dd class="message message"><ul><li>'+options.content+'</li></ul></dd></dl>';
  26.                                         div.hide();
  27.                                         div.html(html)
  28.                                         div.show("1000");
  29.                                 }else if(type == "error"){
  30.                                         var html ='<dl id="system-message"><dt class="error">错误</dt><dd class="error message"><ul><li>'+options.content+'</li></ul></dd></dl>';
  31.                                         div.hide();
  32.                                         div.html(html)
  33.                                         div.show("1000");
  34.                                 }else if(type == "warn"){
  35.                                         var html ='<dl id="system-message"><dt class="notice">注意</dt><dd class="notice message"><ul><li>'+options.content+'</li></ul></dd></dl>';
  36.                                         div.hide();
  37.                                         div.html(html)
  38.                                         div.show("1000");
  39.                                 }else if(type == "editor"){
  40.                                         var html = '<div style="height: auto;" class="editor_hint" id="qzEditor_1_tips"><div class="editor_hint_cont">'+options.content+'</div></div>';
  41.                                         div.hide();
  42.                                         div.html(html)
  43.                                         div.show("1000");
  44.                                        
  45.                                 }
  46.                        
  47.                                 if(options.isVanish){
  48.                                         setTimeout(function(){div.hide(options.vanish,function(){div.html("");})},options.vanish);
  49.                                 }
  50.                         }
  51.         });
  52.                
  53.     };
  54. })(jQuery);
复制代码
message.zip (66.88 KB, 下载次数: 4)
1

查看全部评分

分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
分享分享0 收藏收藏0
命运的手,推我向前!何处是停歇!

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

2#
混混@普宁.中国 实名认证  发表于 2011-9-28 23:39:30 |只看该作者
Snail 来咱们论坛当版主

好不好

使用道具 举报

Rank: 8Rank: 8

风雨相伴

3#
Snail 实名认证  发表于 2011-9-29 08:18:40 |只看该作者
混混@普宁.中国 发表于 2011-9-28 23:39
Snail 来咱们论坛当版主

好不好

  我和乐意啊!只是我没有这方面的经验哦!
命运的手,推我向前!何处是停歇!

使用道具 举报

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

4#
混混@普宁.中国 实名认证  发表于 2011-9-29 17:04:06 |只看该作者
Snail 发表于 2011-9-29 08:18
我和乐意啊!只是我没有这方面的经验哦!

直接超版了  

使用道具 举报

Rank: 8Rank: 8

风雨相伴

5#
Snail 实名认证  发表于 2011-9-29 20:02:42 |只看该作者
混混@普宁.中国 发表于 2011-9-29 17:04
直接超版了

那我可不能辜负重望啦
命运的手,推我向前!何处是停歇!

使用道具 举报

您需要登录后才可以回帖 登录 | 加入学盟

手机版|Scripts 学盟   |

GMT+8, 2024-5-2 10:00 , Processed in 1.167117 second(s), 16 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部