网站子导航悬浮-横向

2360
<div class="sub_cat j_sub_class clearfix">
    <div class="kwidth">
     <a href="">玄玄博客</a>
     <a href="">玄玄博客</a>
     <a href="">玄玄博客</a>
</div>
</div>


<script>
$(function(){
    if ($('.j_sub_class')[0]) {
        // 子菜单浮动
        $(window).load(function() {
            var scrollObj = $('.j_sub_class');
            var offsetLeft      = scrollObj.offset().left,
                objOffsetTop    = scrollObj.offset().top,
                objHeight       = scrollObj.height();
            $(window).scroll(function(e){
                var scrollTop = $(document).scrollTop();
                if (scrollTop >= objOffsetTop) {
                    scrollObj.addClass('fixed');
                } else {
                    scrollObj.removeClass('fixed');
                }
            });
        }); 
    } 
});
</script>
/*子分类*/
.fixed{position:fixed; top:0px; _position:absolute; _top:0px;z-index:99999;}
.sub_cat{display:block;width:100%;padding:10px 0;border-bottom:1px solid #eaeaea;background:#fff;overflow:hidden;}
.sub_cat a{float:left;height:12px;line-height:12px;margin:3px 10px 3px 0;padding:10px 25px;border:1px solid #e8e8e8;background:#f2f2f2;overflow:hidden;}

玄玄博客 http://www.blogxuan.com/