Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
TypeError: $ is not a function. What does that mean

I'm trying this on my website to make my header sticky but hide while scrolling. On line 4 I'm getting this error Uncaught TypeError: $ is not a function I don't know what I'm messing up with

let didScroll;
let lastScrollTop = 0;
let delta = 5;
let navbarHeight = $('header').outerHeight();

window.scroll(function(event){
    didScroll = true;
});

setInterval(function() {
    if (didScroll) {
        hasScrolled();
        didScroll = false;
    }
}, 250);

function hasScrolled() {
    let st = this.scrollTop();
    
    
    if(Math.abs(lastScrollTop - st) <= delta)
        return;
    
    
    
    if (st > lastScrollTop && st > navbarHeight){
        
        $('header').classList.remove("nav-down").classList.add("nav-up");
    } else {
        
        if(st + window.height() < document.height()) {
            $('header').classList.remove("nav-up").classList.add("nav-down");
        }
    }
    
    lastScrollTop = st;
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!