html右侧弹框,javascript实现简单的页面右下角提示信息框

由于之前找到一个开源的很好用,可以固定在浏览器的右下角;兼容性也很好;加上之后影响到应用的一个小功能点,决定重写一个;这个只能固定在当前页面的右下加,系统是上下结构满足需求,没在继续扩展;

两个函数:

1.lay -- 设置提示框高宽(可选)

2.show -- 设置标题,内容,和停留时间

notice.js

var time;

var delayTime;

$(function(){

// 增加浮动DIV

$('body').append("

  [关闭]
");

// 更改样式

$('#notice').css({right:"0",bottom:"0",cursor:"default",position:"fixed","background-color":"#CFDEF4",color:"#1F336B","z-index":"999",border:"1px #1F336B solid",margin:"2px",padding:"10px","font-weight":"bold","line-height":"25px",display:"none"});

$('#notice .cbtn').css({color:"#FF0000",cursor:"pointer","padding-right":"5px",float:"right",position:"relative"});

$('#notice .notice_content').css({margin:"3px","font-weight":"normal",border:"1px #B9C9EF solid","line-height":"20px","margin-bottom":"10px",padding:"10px"});

/* 绑定事件*/

$('#notice').hover(

function(){

$(this).stop(true,true).slideDown();

clearTimeout(time);

},

function(){

time = setTimeout('_notice()',delayTime);

}

);

//绑定关闭事件

$('.cbtn').bind('click',function(){

$('#notice').slideUp('fast');

clearTimeout(time);

});

});

$.extend({

lay:function(_width,_height){

$('#notice').css({width:_width,height:_height});

},

show:function(_title,_msg,_time){

delayTime = _time;

$('.notice_title').html(_title);

$('.notice_content').html(_msg);

$('#notice').slideDown(2000);

time = setTimeout('_notice()',delayTime);

},

});

function _notice(){

$('#notice').slideUp(2000);

}

index.html

index.html

function initPage(){

var returnMsg = "

信息1 jquery-1.7.2.min.js

信息2 notice.js

信息3

";

$.show('提示信息',returnMsg,10000);

}

以上所述就是本文的全部内容了,希望大家能够喜欢。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值