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

首頁 > 編程 > JavaScript > 正文

jQuery實(shí)現(xiàn)仿新浪微博浮動(dòng)的消息提示框(可智能定位)

2019-11-20 11:28:44
字體:
供稿:網(wǎng)友

本文實(shí)例講述了jQuery實(shí)現(xiàn)仿新浪微博浮動(dòng)的消息提示框。分享給大家供大家參考。具體如下:

這是一款jQuery實(shí)現(xiàn)的仿新浪微博新消息提示框效果,支持智能浮動(dòng)定位框,新浪微博用來提示消息時(shí)候的智能定位框,可以適時(shí)關(guān)閉窗口,你完全可以將其應(yīng)用到你網(wǎng)頁的其它地方。

運(yùn)行效果截圖如下:

在線演示地址如下:

http://demo.VeVB.COm/js/2015/js-f-sina-weibo-info-dlg-demo/

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>仿新浪微博新消息提示的智能浮動(dòng)定位框</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><style type="text/css"> *{margin:0;padding:0;}body{font:12px/1.8 Arial;color:#666;}h1.tit-h1{font-size:38px;text-align:center;margin:30px 0 15px;color:#f60;}.go-back{text-align:center;border-top:1px dashed #ccc;padding:10px;margin-top:20px;font-size:40px;}.wrap{border:1px dashed #ccc;background:#f8f8f8;padding:20px;}.demo{height:1500px;}.float{width:200px;padding:5px 10px;border:1px solid #ffecb0;font-size:12px;background-color:#fffee0;-moz-box-shadow:1px 1px 2px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.2);box-shadow:1px 1px 2px rgba(0,0,0,.2);position:absolute;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}.float .close-ico{position:absolute;top:5px;right:5px;display:block;width:16px;height:16px;}/* Head Fixed */.fixed-top{position:fixed;bottom:auto;top:0px;}/* Foot Fixed */.fixed-bottom{position:fixed;bottom:0px;top:auto;}/* Left Fixed */.fixed-left{position:fixed;right:auto;left:0px;}/* RIGHT Fixed */.fixed-right{position:fixed;right:0px;left:auto;}* html,* html body{background-attachment:fixed;}/* IE6 Head Fixed */* html .fixed-top{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}/* IE6 RIGHT Fixed */* html .fixed-right{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}/* IE6 Foot Fixed */* html .fixed-bottom{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}/* IE6 Left Fixed */* html .fixed-left{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}</style> <script type="text/javascript" src="jquery-1.6.2.min.js"></script><script type="text/javascript">/** * @author:愚人碼頭 * 類似于新浪微博新消息提示的定位框 */(function($){ $.fn.capacityFixed = function(options) { var opts = $.extend({},$.fn.capacityFixed.deflunt,options); var FixedFun = function(element) {  var top = opts.top;  var right = ($(window).width()-opts.pageWidth)/2+opts.right;  element.css({  "right":right,  "top":top  });  $(window).resize(function(){  var right = ($(window).width()-opts.pageWidth)/2+opts.right;  element.css({   "right":right  });  });  $(window).scroll(function() {  var scrolls = $(this).scrollTop();  if (scrolls > top) {   if (window.XMLHttpRequest) {   element.css({    position: "fixed",    top: 0   });   } else {   element.css({    top: scrolls   });   }  }else {   element.css({   position: "absolute",   top: top   });  }  });  element.find(".close-ico").click(function(event){  element.remove();  event.preventDefault();  }) }; return $(this).each(function() {  FixedFun($(this)); }); }; $.fn.capacityFixed.deflunt={right : 100,//相對(duì)于頁面寬度的右邊定位 top:150, pageWidth : 960 };})(jQuery);</script></head><body><div style="height:2000px;"></div><div class="wrap"> <div class="float" id="float">  <p>1條新私信,<a href="#">查看私信</a></p>  <p>108個(gè)新粉絲,<a href="#">查看粉絲</a></p>  <a href="#" title="關(guān)閉" id="" class="close-ico">×</a> </div></div><script type="text/javascript">$("#float").capacityFixed();</script></body></html>

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 泾川县| 莱西市| 化德县| 若羌县| 深泽县| 泊头市| 顺平县| 会宁县| 庄浪县| 新营市| 浦江县| 阿克苏市| 沐川县| 奉化市| 浠水县| 宜宾市| 定陶县| 万安县| 常山县| 乌什县| 益阳市| 金乡县| 图们市| 乌什县| 祁连县| 仙桃市| 错那县| 玛纳斯县| 河津市| 志丹县| 台北县| 临沧市| 夹江县| 高安市| 哈巴河县| 崇阳县| 修文县| 宜丰县| 嵊泗县| 松原市| 承德市|