问答详情
源自:2-1 技术实现

var JWin = $(window);

jWin.scroll(function()){

  var scrollHeight = jWin.scrollTop();

  var screenHeight = jWin.height();

  var sideHeight = $('#J_BdSide').height();

  if(scrollHeight+screenHeight>sideHeight){

    $('#J_Bdside').css({

      'position':'fixed',

      'top':-(sideHeight-screenHeight),

      'right':0

    })

  }else{

    $('#J_Bdside').css({

      'position':'static'

    })

  }

}

提问者:爆破熊 2014-08-26 18:35

个回答