How can I add a class to an element that has a fixed position, after it reaches 200px from the bottom of the page, using jquery? This is my to-top page button and I want it to be atached to the footer after its scrooled 200px until the pages end. The fixed position is 50px from the right and botom.
if (pageheight - 200px) {
$(div1).addClass("top-position");
} else {
$(div1).removeClass("top-position");
}