求助js高手侧栏隐藏需要怎样修改代码?
本帖最后由 匿名 于 2014-10-27 11:20 编辑<div class="slide_pos">
<div class="fix_parent">
</div>
<div class="fix_div">
<p>
<a class="links1" target="_blank">美容</a>
</p>
<p>
<a href="#block2" class="links2">减肥</a>
</p>
<p>
<a href="#block2" class="links2">娱乐</a>
</p>
<p>
<a href="#top" class="links3">回顶部</a>
</p>
</div>
</div>
</div>css代码:.side {width: 62px; height: 2580px; position:absolute; top:380px; left:50%; margin-left:500px;_display:none;}
.fix_parent{ width:100%; float:left; height:0px; overflow:hidden;}
.fix_div{float:left; overflow:hidden; width:62px; height:380px; background-position:-400px 0px; }
.fix_div p{ float:left; width:62px;}
.fix_div a{ display:block;}
.fix_div .links1{ width:62px; height:32px; margin-top:10px; text-indent:-9999px; }
.fix_div .links2{width:62px; height:32px; line-height:32px; text-indent:21px; color:#252525;}
.fix_div .links3{ width:62px; height:45px; margin-top:10px; text-indent:-9999px; }js代码如下$(function () { if ($(".fix_div").length > 0) { var top = $(".fix_parent").offset().top; var left = $(".fix_parent").offset().left; var ie = ietester(); $(window).scroll(function () { var limit = $(".side").offset().top + $(".side").height() - $(".fix_div").height(); if ($(window).scrollTop() >= limit) { $(".fix_div").css({ position: "static", top: limit, left: left }) } else { if (top <= $(window).scrollTop()) { if (ie <= 6) { $(".fix_div").css({ position: "absolute", top: ($(window).scrollTop()), left: left }) } else { $(".fix_div").css({ position: "fixed", top: "50px", left: left }) } } else { $(".fix_div").css({ position: "static", top: 0 }) } } }) } }); function ietester() { var undef, ie, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while (div.innerHTML = '<!--><i></i><!-->', all); v > 4 ? ie = v : ie = undef; return ie } 大神今天都很忙吗?求助啊 :( 等我学会了给你看看。你等我半年 这个我不懂啊 carefree 发表于 2014-10-27 09:12 static/image/common/back.gif
你的CSS呢
css已经补上了 网建的大神帮看下吧 :( display:none
页:
[1]