---
title: "jQuery插件之-右下角弹出提示窗体popMessage"
author: "小丑鱼0703"
date: "2015-03-20T10:57:28Z"
tags: []
categories: ["Web前端"]
slug: "jquery-popmessage"
draft: false
lastmod: "2015-03-20T10:56:25Z"
id: 2193899
url: "https://wangjingyi.iteye.com/blog/2193899"
---

优点：右下角弹出同时可配置对应的开始和结束的animated的效果 缺点：没有对外的api支持例如控制显示和隐藏 \[code="java"] \[/code] 附件1：css默认样式源码\[code="css"] @charset "utf-8"; .Pop-Message-container{background:url(../images/wke-dialog-panel\_title.png) repeat;position:absolute;right:0px;border:1px solid #ccc;box-shadow:3px 3px 3px rgba(0, 0, 0, 0.2);border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;} .Pop-Message-title{color:#7297a9;height:26px;line-height:22px;position:relative;padding:10px;padding-bottom:0;border-bottom:1px solid #ccc;} .Pop-Message-close,.Pop-Message-close-hover{background:url(../images/wke-dialog-panel\_tools.gif) no-repeat scroll -16px 0;width:16px;height:16px;position:absolute;top:10px;right:10px;filter:alpha(opacity=60);opacity:0.6;-moz-opacity:0.6;cursor:pointer;} .Pop-Message-close-hover{opacity:1;filter:alpha(opacity=100);-moz-opacity:1;} .Pop-Message-con{background:url(../images/con\_bg.png) no-repeat #fff;} .ime-btn,.ime-btn-hover{background:url(../images/btn.png) no-repeat;height:29px;width:91px;display:inline-block;position:absolute;left:100px;top:273px;} .ime-btn:hover{background:url(../images/btn-hover.png) no-repeat;} .Pop-Message-body{padding:10px;} .Pop-Message-footer{height:25px;border-top:1px solid #ccc;padding:10px 0 0 10px;color:#7297a9;} .noNotice{margin-left:5px;} \[/code] 附件2：jquery插件源码\[code="js"] (function(){ /\*设计定位为作为一般的插件\*/ $.extend($.fn,{ popMessage : function(options){ //合并配置 options = $.extend({},$.fn.popMessage.defaults,options); //render container var container = $('

').addClass('Pop-Message-container').css({'width':options.width,'display':'none','height':'auto','zIndex':options.zIndex}); //这边为了防止ie6下select的遮盖问题 //思路是判断是否加载了jquery.bgiframe.js if($.fn.bgiframe){ container.bgIframe(); } //title var title = $('

').addClass('Pop-Message-title').appendTo(container); title.text(options.title); //conWrap //更改策略可以设置高度 但是container还是auto的设置的是conWrap的高度 var conWrap = $('

').addClass('Pop-Message-con').appendTo(container).css('height',options.height != 'auto' ? options.height : 'auto'); //messageBody var messageBody = $('

').addClass('Pop-Message-body').appendTo(conWrap); //增加一个尾部 var footer = $('

').addClass('Pop-Message-footer').appendTo(container); //footer的具体 var footerCon = $('下次不在提醒').appendTo(footer); //判断是否支持远程调用 if(options.loadUrl != ''){ messageBody.load(options.loadUrl); }else{ if(options.html){ messageBody.html(options.content); }else{ messageBody.text(options.content); } } //关闭按钮 if(options.closeBtn){ var closeBtn = $('