欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

absolute的固定不动 相当于 fixed 有大用

shiping1 的头像
//滚动条滚动时的滚动的高度
function getScroll()
{
        var t=0;
        if(document.documentElement && document.documentElement.scrollTop){
            t = document.documentElement.scrollTop;}
        else if(document.body){
            t = document.body.scrollTop;
        }
        return t;
}
//可见窗口的高度
function getHeight()
{
    var t = 0;
    if(document.documentElement && document.documentElement.clientHeight){
            t = document.documentElement.clientHeight ;}
        else if(document.body){
            t = document.body.clientHeight;
    }
    return t;


}    
$(window).scroll(function(){
        var tScroll = getScroll();
        t1 = tScroll+120;
        
        $('#looyuouter').css('top',t1+'px');
        
        var tHeight =  getHeight();  
        //alert(t);
        //alert(t2);    
        t2 = tScroll+tHeight-357;//滚动高度 + 页面高度 - 本身高度
        $('#miaov_float_layer_zx_right').css('top',t2+'px')
});
普通分类: