Unable to target elements in nav/header with jQuery


#1

Hi there, I’m attempting to animate a page element on click, and am unable to target any element inside my nav.html file. I am using the Victor-Hugo boilerplate with Sass preprocessing added. Repo for reference.

I am able to target elements in my index.html and elsewhere just fine.

Particularly looking at the code in my app.js and nav.html. You can see my code here.

Happy to share any helpful information, and any help is greatly appreciated, thanks!


#2

Do you have a working url so we can better see what the issue is?

How are you trying to "target"your nav element? This is more of a JS question than it is a hugo issue but we need more details.


#3

Yes! https://crl-news.netlify.com/

Using jQuery, as such:

$("body").on('click', '#bars', function() {
 if($("#sidenav").css("width")!= "250px") {
   openNav();
 }
 else {
   closeNav();
 }
});`