The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery .offset() returning wildly different values between local dev & server

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #165570


    Please take a look at

    I am using bootstrap’s affix plugin ( to trigger the animated elements. Since we are using it on a responsive site, the offset from the top varies greatly depending on the width of the screen. To combat this, I am running the following code to update the ‘data-offset-top’ attribute:

    $('*[data-spy="affix"]').each(function() {
            var offset = $(this).offset();
    $(this).attr('data-offset-top', ( / 2));

    Which accomplished the desired effect nicely.

    However, when run in my local dev environment the values are roughly half of that when they are when calculated on our remote demo server.

    It’s not the end of the world, but I was wondering if anyone had encountered this in the past.



    You know what – you’re absolutely right. I am using a lazy-load plugin for the images which would absolutely account for the difference in height.

    Thanks for taking a look.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.