jQuery实现页面滚动时层智能浮动定位
来源:互联网 发布:手机记录仪软件 编辑:程序博客网 时间:2024/05/19 05:02
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery实现页面滚动时层智能浮动定位小插件</title>
<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; }
</style>
<script type="text/javascript" src="http://www.lizhoumin.com/js.js"></script>
</head>
<body>
<h1 class="tit-h1">jQuery实现页面滚动时层智能浮动定位</h1>
<div style="width:960px; margin:0 auto;"><p style="font-size:20px; color:#f00; background:#000; color:#fff; text-align:center; font-weight:800;">与别人分享快乐,你的快乐就会加倍,与别人分担痛苦,你的痛苦就会减半。</p></div>
<div class="wrap">
<script type="text/javascript">
(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,//相对于页面宽度的右边定位
top:150,
pageWidth : 960
};
})(jQuery);
</script>
<div class="float" id="float">
<p>1条新私信,<a href="http://www.lizhoumin.com/">查看私信</a></p>
<p>10条新消息,<a href="http://www.lizhoumin.com/">查看消息</a></p>
<p>108个新粉丝,<a href="http://www.lizhoumin.com/">查看粉丝</a></p>
<a href="#" title="关闭" id="" class="close-ico">关闭</a>
</div>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<script type="text/javascript">
$("#float").capacityFixed();
</script>
</div>
<div style="height:500px;"></div>
</body>
</html>
- jQuery实现页面滚动时层智能浮动定位
- jQuery实现页面滚动时层智能浮动定位
- 页面滚动时层智能浮动定位,jQuery/MooTools实现
- jQuery实现页面滚动时层智能浮动定位
- js页面滚动浮动层智能定位(jQuery)实现
- JQuery页面滚动浮动层智能定位
- js页面滚动时层智能浮动定位实现
- js页面滚动时层智能浮动定位实现(jQuery/MooTools)
- js页面滚动浮动层智能定位(jQuery)实例页面
- js实现滚动时层智能浮动定位
- jQuery实现页面滚动时元素的智能定位
- jQuery实现浮动层跟随页面滚动效果
- jQuery浮动层跟随页面滚动
- JQuery实现的页面滚动时浮动窗口控件
- jQuery实现页面元素智能定位
- jquery浮动定位层导航描点上下滚动的浮动导航
- jQuery实现浮动层
- jQuery 实现拖动浮动层
- 第8周实验报告4
- js中弹出新窗口并提交需要在新窗口中显示的数据
- WP7 多媒体控件
- android 网络下载的I/0 流细节注意
- NSdata与NSString,Byte数组,UIImage的相互转换
- jQuery实现页面滚动时层智能浮动定位
- 调用Android系统“应用程序信息(Application Info)”界面
- oracle中实现continue,break
- 突然的想法
- 求最大公约数(GCD)
- usb 转串口 链接板子
- object-C 判断字符串是否含有特殊字符
- Oracle复制某一个字段 批量修改(我们可以在插入的时候修改)
- java面试题及答案