【问题标题】:chrome not workign .offset().top铬不工作 .offset().top
【发布时间】:2012-08-03 10:39:15
【问题描述】:

在 chrome 中不工作.... element.offset().top 任何建议

$(window).load(function() {

  $(".scroll-box").scroll(function(){
    $('#document_activity .doc-draft.item.parent').each(function(i) {
      $movingLableTop = [];
      $movingLableHeight = [];
      $fixedLableTop = $('#fixed_version').find('.version').offset().top;
      $movingLableTop.push($(this).offset().top);
      $movingLableHeight.push($(this).height());
      if ($fixedLableTop > ($movingLableTop + $movingLableHeight)){
        $('#fixed_version').find('.version').html($(this).find('.version').html());
      }
    });
  });

});

很多人提到 chrome 无法为 offset() 获得正确的值

【问题讨论】:

  • 什么不起作用?它在做什么你意想不到的事情?你指的“很多人”是谁?您使用的是什么版本的 chrome、HTML、JQuery 等?
  • chrome version 版本 21.0.1180.57 jquery v1.7.2 $(this).offset().top 在 chrome 中没有任何工作...

标签: jquery google-chrome offset


【解决方案1】:

谢谢它的修复现在可以工作了

而不是这个 $(this).offset().top

通过使用

$(this).position().top

【讨论】:

    猜你喜欢
    • 2012-05-24
    • 1970-01-01
    • 2012-05-20
    • 1970-01-01
    • 2022-07-23
    • 1970-01-01
    • 2014-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多