[jquery ajax]Jquery 弹出内容提示插件

更新时间:2018-01-28    来源:jquery    手机版     字体:

【www.bbyears.com--jquery】

 代码如下

 

$(function() {
 $.fn.manhua_msgTips = function(options) {
  var defaults = {
   Event : "click",   //响应的事件
   timeOut : 3000,    //提示层显示的时间
   msg : "thank you!",   //显示的消息
   speed : 300,    //滑动速度
   type : "success"   //提示类型(1、success 2、error 3、warning)
  };
  var options = $.extend(defaults,options);
  var bid = parseInt(Math.random()*100000);
  $("body").prepend("");
  var $this = $(this);
  var $tip_container = $("#tip_container"+bid)
  var $tip = $("#tip"+bid);
  var $tipSpan = $("#tsc"+bid);
  var $colse = $("#mclose"+bid);
  
  //先清楚定时器
  clearTimeout(window.timer);
  
  //主体元素绑定事件
  $this.die().live(options.Event,function(){
   $tip.attr("class", options.type).addClass("mtip"); 
   $tipSpan.html(options.msg);   
   $tip_container.slideDown(options.speed);
   //提示层隐藏定时器
   window.timer = setTimeout(function (){
    $tip_container.slideUp(options.speed);
   }, options.timeOut);
  
  }); 

$(function (){
 $("#ie").manhua_msgTips({
  Event : "click",   //响应的事件
  timeOut : 4000,    //提示层显示的时间
  msg : "为了保证更好的网站体验,请升级IE版本到8.0或以上!",   //显示的消息
  speed : 300,    //滑动速度
  type : "warning"   //提示类型(1、success 2、error 3、warning)

 });
 $("#no").manhua_msgTips({
  Event : "click",   //响应的事件
  timeOut : 4000,    //提示层显示的时间
  msg : "很抱歉!您好操作此插件错误,请重新操作!",   //显示的消息
  speed : 300,    //滑动速度
  type : "error"   //提示类型(1、success 2、error 3、warning)

 });
 $("#yes").manhua_msgTips({
  Event : "click",   //响应的事件
  timeOut : 4000,    //提示层显示的时间
  msg : "恭喜你!你已成功操作此插件,谢谢使用!",   //显示的消息
  speed : 300,    //滑动速度
  type : "success"   //提示类型(1、success 2、error 3、warning)

 });

});

本文来源:http://www.bbyears.com/wangyezhizuo/38847.html

热门标签

更多>>

本类排行