网页右侧的漂浮广告代码,随滚动条滚动
2012-11-22 14:11
453 查看
HTML代码(即需要漂浮的广告):
<div class="christmas_ad" style="width:155px; height:220px; position:absolute; top:250px; right:25px;">
<a href="javascript:void(0)" ><img src="/themes/mall/wowsai/topics/images/christmas_2012/christmasAcvance.png" border="0" /></a>
</div>
js代码:前提是必须要引入jquery文件
<script type="text/javascript">
$(function(){
$(window).scroll(function(){
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop || 0;
$(".christmas_ad").stop();
var scrollTop2 = (scrollTop+160) - $(".christmas_ad").position().top;
if(scrollTop> 440){
$(".christmas_ad:not(:animated)").animate({top:"+="+scrollTop2+"px"},1000);
}else{
$(".christmas_ad").css("top",370+"px");
}
})
})
</script>
<div class="christmas_ad" style="width:155px; height:220px; position:absolute; top:250px; right:25px;">
<a href="javascript:void(0)" ><img src="/themes/mall/wowsai/topics/images/christmas_2012/christmasAcvance.png" border="0" /></a>
</div>
js代码:前提是必须要引入jquery文件
<script type="text/javascript">
$(function(){
$(window).scroll(function(){
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop || 0;
$(".christmas_ad").stop();
var scrollTop2 = (scrollTop+160) - $(".christmas_ad").position().top;
if(scrollTop> 440){
$(".christmas_ad:not(:animated)").animate({top:"+="+scrollTop2+"px"},1000);
}else{
$(".christmas_ad").css("top",370+"px");
}
})
})
</script>
相关文章推荐
- 网页右侧的漂浮广告代码,随滚动条滚动
- jQuery网页右侧广告跟随滚动代码分享
- 符合标准的随滚动条滚动的广告代码,在滚动条右侧滚动
- jQuery网页右侧广告跟随滚动代码分享
- 网页JS弹出广告代码,头部,右下角,网页中漂浮,对联广告代码等大全
- JavaScript实现带缓冲效果的随屏滚动漂浮广告代码
- 网页中广告随着滚动条滚动位置不变
- --常用网页漂浮广告代码--
- 网页两侧可以上下滚动的广告的代码
- 随网页滚动条漂浮的可展开和收起的QQ代码 转
- 超简单 无缝滚动 漂浮广告 代码属性
- JavaScript实现带缓冲效果的随屏滚动漂浮广告代码
- 符合3w标准的网页漂浮广告代码
- Javascript实现带关闭按钮的网页漂浮广告代码
- JS带关闭按钮的网页漂浮广告代码
- 超强无法拦截的网页漂浮图片广告代码
- 网页右侧悬浮滚动在线qq客服代码示例
- 网页右侧悬浮滚动在线qq客服代码示例
- 随滚动条滚动的图片广告代码(图片还可以拖动)
- 网页JS弹出广告代码,头部,右下角,网页中漂浮,对联广告代码等大全