I'm designing a personal Web page with ASP.NET. In order to make a sticky div inside my page, i'm using jQuery. All of my jQuery functions work well except my sticky div functions.
stickydiv.js
$(document).ready(function () {
var s = $("#stick_body");
var pos = s.position();
$(window).scroll(function () {
var windowpos = $(window).scrollTop();
s.html("Distance from top:" + pos.top + "<br />Scroll position: " + windowpos);
if (windowpos >= pos.top) {
s.addClass("stick");
} else {
s.removeClass("stick");
}
});
});
i've placed this file's reference inside my content page(hobbies.aspx). Also, main jquery file (jquery-latest.min.js) is placed inside master page's section. But when i run the project, it give's an error:
Unhandled exception at line 1, column 2 in http...stickydiv.js 0x800a138f - JScript Runtime Error: Object Expected.
I tried to reference stickydiv.js file inside masterpage but it didn't work.