article

Sunday, February 19, 2012

Jquery Floating Banners

Jquery Floating Banners








<script type="text/javascript" src="../jquery-1.2.6.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(window).scroll(function(){
if ($(window).scrollTop() > $(".Bannerscroll").offset({ scroll: false }).top){
$(".bannerleftscroll").css("position", "fixed");
$(".bannerleftscroll").css("top", "0");
}
if ($(window).scrollTop() <= $(".Bannerscroll").offset({ scroll: false }).top){
$(".bannerleftscroll").css("position", "relative");
$(".bannerleftscroll").css("top", $(".Bannerscroll").offset);
}
});
});
</script>
<style>
.mainWrap {
width: 900px;
margin: 0 auto;
}
.Wrap {
float: right;
width:600px;
background-color: #F0F0F0;
padding: 10px;
height:900px;
}
.bannerleft {
float: left;
width:250px;
}
.bannerleftscroll {
width:250px;
background-color: #FF0000;
}
</style>
<div class="mainWrap">
<div class="Wrap">
<iframe src="http://r-ednalan.blogspot.com/" width="600" height="900" frameborder="0"></iframe>
</div>
<div class="bannerleft">
<div class="bannerleftscroll">
<iframe src="http://r-ednalan.blogspot.com/" width="250" height="300" frameborder="0"></iframe>
</div>
<div class="Bannerscroll"></div>
</div>
</div>

Related Post