国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

javascript實現簡單的頁面右下角提示信息框

2019-11-20 11:57:08
字體:
來源:轉載
供稿:網友

由于之前找到一個開源的很好用,可以固定在瀏覽器的右下角;兼容性也很好;加上之后影響到應用的一個小功能點,決定重寫一個;這個只能固定在當前頁面的右下加,系統是上下結構滿足需求,沒在繼續擴展;
兩個函數:
1.lay -- 設置提示框高寬(可選)
2.show -- 設置標題,內容,和停留時間

notice.js

var time;var delayTime;$(function(){  // 增加浮動DIV  $('body').append("<div id='notice' onselectstart='return false'><span class='notice_title'> </span><span class='cbtn'>[關閉]</span><div class='notice_content'></div></div>");     // 更改樣式  $('#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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html> <head>  <title>index.html</title>     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>  <meta http-equiv="description" content="this is my page"/>  <meta http-equiv="content-type" content="text/html; charset=GBK"/>     <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->  </head>   <body onload='initPage();'> </body> <script type="text/javascript">  function initPage(){    var returnMsg = "<p>信息1 jquery-1.7.2.min.js</p><p>信息2 notice.js</p><p>信息3</p>";    $.show('提示信息',returnMsg,10000);  } </script> <script src="jquery-1.7.2.min.js" type="text/javascript" ></script> <script src="notice.js" type="text/javascript" ></script></html>

以上所述就是本文的全部內容了,希望大家能夠喜歡。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 内黄县| 临高县| 平阳县| 屏边| 泸西县| 绥中县| 休宁县| 高邑县| 枣庄市| 宁武县| 井研县| 灵川县| 太谷县| 壶关县| 视频| 株洲县| 龙胜| 温州市| 惠来县| 琼结县| 东阳市| 荣昌县| 侯马市| 丹阳市| 石城县| 江口县| 中西区| 绥中县| 宿迁市| 宝山区| 农安县| 安新县| 德江县| 滨海县| 雷山县| 游戏| 奉化市| 会昌县| 青浦区| 保德县| 通道|