19 lines
427 B
JavaScript
19 lines
427 B
JavaScript
|
|
||
|
|
||
|
console.log("test");
|
||
|
console.log($("#homeLink").offset().top);
|
||
|
|
||
|
let topOffset
|
||
|
|
||
|
topOffset = $("#homeLink").offset().top -13;
|
||
|
$(window).scroll(()=>{
|
||
|
|
||
|
if ($(document).scrollTop() >= topOffset) {
|
||
|
$("#homeLink").addClass("fixedPos")
|
||
|
|
||
|
console.log("fixed");
|
||
|
} else if ( $(document).scrollTop() < topOffset){
|
||
|
$("#homeLink").removeClass("fixedPos")
|
||
|
console.log("unfixed");
|
||
|
}
|
||
|
})
|