javascript - Why does my JS mobile nav work on all my pages but one? -


i'm building website, , have mobile dropdown menu controlled js (and appears @media queries devices under 400px). website jeffarries.com (and page i'm talking live there), mobile nav works on of other pages, not politics page. thing isn't working bars open , close nav dropdown don't rotate , body isn't set position: fixed;. why js work on page politics?

thanks!

p.s. can provide code, it's 250+ line , in different files, think best if view on website. (i'm not trying sound lazy, if want code, ask , provide it)

why js mobile nav work on pages one?

because have javascript error!

check browsers console , see it:

typeerror: null not object (evaluating 'document.getelementbyid("javascript_warning").style')

if on line 331 of politics.js file see following function:

// hides javascript warning message function myfunction() {     document.getelementbyid("javascript_warning").style.display = "none"; } 

this causing error because document.getelementbyid("javascript_warning") null , trying call style on it.

make sure element exists first e.g.

// hides javascript warning message function myfunction() {     var elem = document.getelementbyid("javascript_warning");     if (elem != null) {         elem.style.display = "none"     } }; 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -