Am getting an error when i run my site in IE (local host)
the error is as follows:
Unhandled exception at line 1440, column 9 in eval code
0x800a138f - JavaScript runtime error: Unable to get property 'top' of undefined or null reference
If there is a handler for this exception, the program may be safely continued.
This is the code it goes to:
 $window.scroll(function () {
if ($window.scrollTop() > offset.top) {
        $sidebar.stop().animate({
            marginTop: $window.scrollTop() - offset.top + topPadding
        });
    } else {
        $sidebar.stop().animate({
            marginTop: 0
        });
    }
});
the highlighted code is where it keeps hitting when i scroll on the page.
Am not sure why this is happening, has this happened to anyone? Or any ideas why its doing this.
Thanks
It's all in the error message:
"Unable to get property 'top' of undefined or null reference"
That means that whatever you're trying to get top from, is undefined or null.
Specifically: offset is.
You might have got confused between offset.top with window.top
just review your code once again. And try replacing your 'offset.top' with 'window.top'
User contributions licensed under CC BY-SA 3.0