jQuery实现拉动页面固定顶部显示且自动消失(火狐)
2012-12-26 00:00
701 查看
回到顶部:哭泣的小丑
html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend, input,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, embed,figure, figcaption, footer, header, hgroup,menu, nav, output, ruby, section, summary,time, mark, audio, video {margin: 0;padding: 0;border: 0;font-size: 100%;}
article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;float:left;}select, input, button,button img, label {vertical-align: middle;}body {font:normal 12px/1.5 "Microsoft Yahei","微软雅黑",Tahoma,Arial,Helvetica,STHeiti; webkit-font-smoothing:antialiased;-moz-font-smoothing: subpixel-antialiased; color:#666;}ol, ul {list-style: none;}blockquote, q {quotes: none;}blockquote:before, blockquote:after,q:before, q:after {content: '';content: none;}table {border-collapse: collapse;border-spacing: 0;}em {font-style: normal}select, input, button, button img, label {vertical-align:middle;}input {font-family:"Microsoft Yahei","微软雅黑";webkit-font-smoothing:antialiased;-moz-font-smoothing: subpixel-antialiased}input, input:focus, button, button:focus, select,textarea, textarea:focus {outline:none; -moz-outline:none; -webkit-outline:none; }input:focus { outline:none; -moz-outline:none; -webkit-outline:none; }textarea {resize:none;}a {color:#666; text-decoration:none;} a:hover {text-decoration:underline;}a:focus {outline:none; -moz-outline:none;-webkit-outline:none;}body {min-width: 960px;}
body{background:#e7e7e7;}
.clearfix:before, .clearfix:after, .container_24:before, .container_24:after {
content: '.'; display: block; overflow: hidden; visibility: hidden; font-size: 0; line-height: 0; width: 0; height: 0;}
.clearfix:after, .container_24:after { clear: both; }
.Xc_main{width:750px;margin:0 auto;position:relative;}
.Xc_left{float:left;}
.Xc_left h1{font-size:24px;padding-top:25px;}
.Xc_right{float:right;width:600px;}
.Xc_right .Xc_list{margin:10px 0 10px 0;}
.Xc_list_top,.Xc_list_main{background:#fff;padding:10px;border:1px solid #ccc;}
.Xc_list_top{margin-bottom:10px;}
.Xc_gg{width:90px;height:90px;border:1px solid #ccc;background:#fff;text-align:center;}
.Xc_bottom{height:650px;background:#fff;padding:10px;border:1px solid #ccc;position:relative;}
$(function () {
$(".Xc_list_top").css("width",$(".Xc_list_main").width());
var resetRightPanelPostion = function () {
var msie6 = $.browser.msie && $.browser.version == '6.0' && $.browser.version < 7;
if ($.browser.safari) {
bodyelem = $("body");
} else {
bodyelem = $("html,body");
}
var bodyTop = bodyelem.scrollTop();
var top = $(".Xc_left").offset().top;
//var t = $("#public_footer").offset().top;
var t = $("#footerDestinationBox").offset().top;
//var bottom = $("#footerDestinationBox").offset().top;
for(var i = 0 ; i < $(".Xc_list .Xc_list_top").length ; i++){
if (bodyTop >= top && ((bodyTop + $(".Xc_left").outerHeight()) < t)) {
if (!msie6) {
if (bodyTop + $(".Xc_gg").outerHeight() >= t) {
$(".Xc_gg").removeClass('fixed').css({
"position": "absolute",
"top": t - $(".Xc_gg").outerHeight() + "px"
});
} else {
$(".Xc_gg").css({
"position": "fixed",
"top": 0
});
}
}
} else {
if (!msie6) {
$(".Xc_gg").css({
"position": "static"
});
}
}
if(bodyTop>$(".Xc_list").eq(i).offset().top){
$(".Xc_list_top").eq(i).css({position:"absolute",top:top-168});
}
if(bodyTop>$(".Xc_list").eq(i).offset().top){
$(".Xc_list_top").eq(i).css({position:"fixed",top:0});
}
if(bodyTop
html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend, input,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, embed,figure, figcaption, footer, header, hgroup,menu, nav, output, ruby, section, summary,time, mark, audio, video {margin: 0;padding: 0;border: 0;font-size: 100%;}
article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;float:left;}select, input, button,button img, label {vertical-align: middle;}body {font:normal 12px/1.5 "Microsoft Yahei","微软雅黑",Tahoma,Arial,Helvetica,STHeiti; webkit-font-smoothing:antialiased;-moz-font-smoothing: subpixel-antialiased; color:#666;}ol, ul {list-style: none;}blockquote, q {quotes: none;}blockquote:before, blockquote:after,q:before, q:after {content: '';content: none;}table {border-collapse: collapse;border-spacing: 0;}em {font-style: normal}select, input, button, button img, label {vertical-align:middle;}input {font-family:"Microsoft Yahei","微软雅黑";webkit-font-smoothing:antialiased;-moz-font-smoothing: subpixel-antialiased}input, input:focus, button, button:focus, select,textarea, textarea:focus {outline:none; -moz-outline:none; -webkit-outline:none; }input:focus { outline:none; -moz-outline:none; -webkit-outline:none; }textarea {resize:none;}a {color:#666; text-decoration:none;} a:hover {text-decoration:underline;}a:focus {outline:none; -moz-outline:none;-webkit-outline:none;}body {min-width: 960px;}
body{background:#e7e7e7;}
.clearfix:before, .clearfix:after, .container_24:before, .container_24:after {
content: '.'; display: block; overflow: hidden; visibility: hidden; font-size: 0; line-height: 0; width: 0; height: 0;}
.clearfix:after, .container_24:after { clear: both; }
.Xc_main{width:750px;margin:0 auto;position:relative;}
.Xc_left{float:left;}
.Xc_left h1{font-size:24px;padding-top:25px;}
.Xc_right{float:right;width:600px;}
.Xc_right .Xc_list{margin:10px 0 10px 0;}
.Xc_list_top,.Xc_list_main{background:#fff;padding:10px;border:1px solid #ccc;}
.Xc_list_top{margin-bottom:10px;}
.Xc_gg{width:90px;height:90px;border:1px solid #ccc;background:#fff;text-align:center;}
.Xc_bottom{height:650px;background:#fff;padding:10px;border:1px solid #ccc;position:relative;}
$(function () {
$(".Xc_list_top").css("width",$(".Xc_list_main").width());
var resetRightPanelPostion = function () {
var msie6 = $.browser.msie && $.browser.version == '6.0' && $.browser.version < 7;
if ($.browser.safari) {
bodyelem = $("body");
} else {
bodyelem = $("html,body");
}
var bodyTop = bodyelem.scrollTop();
var top = $(".Xc_left").offset().top;
//var t = $("#public_footer").offset().top;
var t = $("#footerDestinationBox").offset().top;
//var bottom = $("#footerDestinationBox").offset().top;
for(var i = 0 ; i < $(".Xc_list .Xc_list_top").length ; i++){
if (bodyTop >= top && ((bodyTop + $(".Xc_left").outerHeight()) < t)) {
if (!msie6) {
if (bodyTop + $(".Xc_gg").outerHeight() >= t) {
$(".Xc_gg").removeClass('fixed').css({
"position": "absolute",
"top": t - $(".Xc_gg").outerHeight() + "px"
});
} else {
$(".Xc_gg").css({
"position": "fixed",
"top": 0
});
}
}
} else {
if (!msie6) {
$(".Xc_gg").css({
"position": "static"
});
}
}
if(bodyTop>$(".Xc_list").eq(i).offset().top){
$(".Xc_list_top").eq(i).css({position:"absolute",top:top-168});
}
if(bodyTop>$(".Xc_list").eq(i).offset().top){
$(".Xc_list_top").eq(i).css({position:"fixed",top:0});
}
if(bodyTop
相关文章推荐
- jQuery实现拉动页面固定顶部显示且自动消失(火狐)
- jQuery实现滑动页面固定顶部显示(可根据显示位置消失与替换)
- jQuery实现滑动页面固定顶部显示(可根据显示位置消失与替换)
- jquery实现当页面滚动超过一屏时显示返回顶部按钮
- jquery实现页面滑动到固定位置显示某个div
- 使用Jquery实现顶部导航栏在页面滑动到自身所在位置之后固定在顶部的效果
- 使用Jquery实现顶部导航栏在页面滑动到自身所在位置之后固定在顶部的效果
- jquery实现的让超出显示范围外的导航自动固定屏幕最顶上
- jQuery实现页面滚动时顶部动态显示隐藏
- 纯JS实现页面滚动至顶部并自动显示或隐藏
- 基于jquery实现页面滚动时顶部导航显示隐藏
- jquery 提示信息显示后自动消失的具体实现
- jQuery实现页面顶部显示的进度条效果完整实例
- jquery 提示信息显示后自动消失的具体实现
- jQuery实现文本域内提示文字,当鼠标点击进文本域后自动消失,文本域失去鼠标焦点后显示提示文字或显示用户输入的文字。
- 纯CSS和jQuery实现的在页面顶部显示的进度条效果2例(仿手机浏览器进度条效果)
- 基于jquery实现页面滚动时顶部导航显示隐藏
- jQuery实现页面滚动时顶部动态显示隐藏
- jQuery实现页面滚动时顶部动态显示隐藏
- jQuery实现页面滚动时元素智能定位,页面导航栏会自动定位到浏览器顶部