类似:http://www.etao.com/,页面往下,左侧的内容会自动跟着往下走。
解决方案 »
- IE10 selectNodes()方法无效!请教高手。。。
- 解决iframe跨域访问
- 用javascript读取注册表问题
- 怎么屏蔽掉初始页面上的地址栏和菜单栏?
- 在搜索时 ,当用户 在textbox输入 王刚,李立 程序能查出王刚和李立两个人的信息 ,拜托了 老兄们
- 过年好,超级紧急问题,如果动态控制iframe中包含的页面?高分求教
- 各位大哥大姐,有人会直接指定某台打印机打印页面吗?
- 如何在JavaScript中调用JSP中的变量? 谢谢大家!
- 难题:刷新能不能没声音啊??
- 请问在DOM1.0中有没有对应IE的DHTML属性innerHtml,innerText,outerHtml,outerText
- EasyUI datagrid 300条记录 合并单元格效率问题
- db.getTableData("US_APP.TB_APP_JTZY_SBTZ", "JZBM=1000002"); 中US...为什么不是table
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>22</title>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script>
<script type="text/javascript"> $(function () {
var category = $('#side_category'),
sidebar = $('.layout_sidebar'),
content = $('.layout_content'),
maxTop, baseTop, scrollTop;
var setPosition = function () {
maxTop = content.height() - category.get(0).offsetHeight;
baseTop = sidebar.offset().top;
scrollTop = $(document).scrollTop();
var t = scrollTop - baseTop;
if (t > 0 && t <= maxTop) {
category.css({ 'position': 'fixed', 'top': 0});
}
else if (t > maxTop) {
category.css({ 'position': 'absolute', 'top': maxTop });
}
else if (t < 0) {
category.css({ 'position': 'relative', 'top': 0 });
}
};
if (category.size()) {
setPosition();
$(window).scroll(function () {
setPosition();
});
}
});</script>
<style type="text/css">
body{padding:0px;margin:0px;}.layout{width:300px;margin:0 auto;border:1px solid #ddd;}
.main{overflow:hidden;}
.layout_sidebar{float:left;overflow:hidden;}
#side_category{width:60px;border:1px solid #ddd;background-color:#ddd;height:200px;}
.layout_content{float:right;width:200px;border:1px solid #ddd;background-color:red;height:600px;}
.foot{border-top:1px solid #ddd;height:800px;background-color:#999;}
</style>
</head>
<body><div class="layout">
<div class="main">
<div class="layout_sidebar">
<div id="side_category">left
</div>
</div>
<div class="layout_content">
right
</div>
</div> </div>
<div class="foot">foot</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<style>
*{margin:0;padding:0;}
.wrap{width:1000px;margin:0 auto;overflow:hidden;*zoom:1;}
.left-box{position:relative;width:50%;float:left;}
.left-box .box{left:0;top:0;background:#f5f5f5;}
.right-box{position:relative;width:50%;float:right;}
.right-box .box{left:0;top:0;background:#e0e0e0;}
</style>
<script>
window.onload = function(){
var leftBox = document.getElementById("left");
var rightBox = document.getElementById("right");
var fixedBox = leftBox.offsetHeight > rightBox.offsetHeight ? rightBox : leftBox;
var isIE6 = !!window.ActiveXObject && !window.XMLHttpRequest; fixedBox.style.width = fixedBox.parentNode.offsetWidth + "px"; if(!isIE6){
fixedBox.style.position = "fixed";
fixedBox.style.left = fixedBox.parentNode.offsetLeft + "px";
}else{
fixedBox.style.position = "absolute";
window.onscroll = function(){
fixedBox.style.top = document.documentElement.scrollTop + "px";
}
}
}
</script>
</head><body>
<div class="wrap">
<div class="left-box">
<div id="left" class="box">
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
<p>left box</p>
</div>
</div>
<div class="right-box">
<div id="right" class="box">
<p>right box</p>
<p>right box</p>
<p>right box</p>
<p>right box</p>
<p>right box</p>
<p>right box</p>
</div>
</div>
</div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script>
<script type="text/javascript"> $(function () {
//获取要定位元素距离浏览器顶部的距离
var navH = $(".Leigl").offset().top;
//滚动条事件
$(window).scroll(function () {
//获取滚动条的滑动距离
var scroH = $(this).scrollTop();
//滚动条的滑动距离大于等于定位元素距离浏览器顶部的距离,就固定,反之就不固定
if (scroH >= navH) {
$(".Leigl").css({ "position": "fixed", "top": 0, opacity: 0.7 });
} else if (scroH < navH) {
$(".Leigl").css({ "position": "static", opacity: 1 });
}
})
});
</script>
<style type="text/css">
.Leig
{
width:100%;
height:1000px;
background: #333;
border:1px red solid;
}
.Leigl
{
width:100%;
height:100px;
background:white;
z-index:9999;
border:1px red solid;
}
</style>
</head>
<body>
<div class="Leig">
<div class="Leigl">
</div>
</div>
</body>
</div>
</html>