*{margin:0;padding:0;}
html,body{margin:0;padding:0;}
img{border:0;}
div,span,p,ul,li,img,a,i,{margin:0;padding:0;}
.div1{width:1000px;height:1600px;background:#FCC;margin:0 auto;position:relative;}
.left{width:10px;height:2000px;background:url(images/123243.png) repeat-y;position:relative;left:250px;position:fixed;}
.left a{position:relative;margin-left:-25px;}
.right{width:800px;height:1000px;background:#C7A7C0;margin:0 auto;}
.n1{width:100%;height:370px;background:#FCD8C7;}
.n2{width:100%;height:370px;background:#FFC;}
.n3{width:100%;height:370px;background:#DFFFDF;}
.n4{width:100%;height:370px;background:#F2D2F7;}
$(document).ready(function(){
$(window).bind("scroll",function(){
var oImg=$(".left").find("img");
var x=$(".n2").offset().top-$(document).scrollTop(); //x为所取div元素与滚动条滚动高度的差,即为所取div元素距离可视区页面顶部的距离。
if(x>=0){
x=x+"px";
oImg.eq(1).css("marginTop",x);
}
else{
oImg.eq(1).css("marginTop",0);
}
});
});
html,body{margin:0;padding:0;}
img{border:0;}
div,span,p,ul,li,img,a,i,{margin:0;padding:0;}
.div1{width:1000px;height:1600px;background:#FCC;margin:0 auto;position:relative;}
.left{width:10px;height:2000px;background:url(images/123243.png) repeat-y;position:relative;left:250px;position:fixed;}
.left a{position:relative;margin-left:-25px;}
.right{width:800px;height:1000px;background:#C7A7C0;margin:0 auto;}
.n1{width:100%;height:370px;background:#FCD8C7;}
.n2{width:100%;height:370px;background:#FFC;}
.n3{width:100%;height:370px;background:#DFFFDF;}
.n4{width:100%;height:370px;background:#F2D2F7;}
$(document).ready(function(){
$(window).bind("scroll",function(){
var oImg=$(".left").find("img");
var x=$(".n2").offset().top-$(document).scrollTop(); //x为所取div元素与滚动条滚动高度的差,即为所取div元素距离可视区页面顶部的距离。
if(x>=0){
x=x+"px";
oImg.eq(1).css("marginTop",x);
}
else{
oImg.eq(1).css("marginTop",0);
}
});
});