$(this).offset().top; //当前节点距离顶端高度
$(window).height(); //当前浏览器窗口高度
$(window).scrollTop(); //被隐藏的上部 高度
$("html,body").height(); //当前页面高度 
node.height(); //当前节点高度

 示例:

var node = $(this).find("div[class='category_over_box']"); //节点 
var nodeHeight = node.height(); //当前节点高度
var currentTop = $(this).offset().top; //当前节点距离顶端高度
var currentWinHidHeight = $(window).scrollTop(); //被隐藏的上部 高度
var currLastHeight = currentTop - currentWinHidHeight; //剩余高度 
node.css("top", "-" + (currLastHeight - 40) + "px");

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2022-03-07
猜你喜欢
  • 2022-01-22
  • 2021-12-22
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案