675 posts
  • Has referred 500+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Joined us in one of our Envato Live Events
+11 more
cudazi Envato team says

I have an odd issue I’ve tracked down to the way chrome 12.0.7 is returning the offset().top value.

I’ve simplified the code down to this sample for testing: (Any time a link is clicked, it should just log the position of an item with the ID of portfolio no matter where you are on the page.)

$('a').click(function() {
    console.log( $('#portfolio').offset().top );    
});

Firefox and Safari work fine, but with Chrome (12.0.7 mac) the value changes depending on where you’re scrolled to along the page like it’s returning scrollTop().

Thanks for any ideas. :)

675 posts
  • Has referred 500+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Joined us in one of our Envato Live Events
+11 more
cudazi Envato team says

...like it’s returning scrollTop().

Like it’s returning $(window).scrollTop() I meant to say.

2024 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Contributed a free file of the month
+8 more
revaxarts says

Is the parent element set to position:relative ?

675 posts
  • Has referred 500+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Joined us in one of our Envato Live Events
+11 more
cudazi Envato team says

No luck on my local example but I think you may be on the right track.

675 posts
  • Has referred 500+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Joined us in one of our Envato Live Events
+11 more
cudazi Envato team says

It seems the target item needs to be explicitly set position: relative for the latest version of Chrome.

by
by
by
by
by
by