Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML jQuery Basics (2014) Creating a Mobile Drop Down Menu Perfect

[SOLVED] Dropdown menu and PHP header issue

I'm using the same approach used in the jQuery Basics course for swapping out a navigation menu for a dropdown menu on smaller screens. I have a back end written in PHP. My problem is that once the dropdown initiates on the smaller views, it's no longer being loaded via the header file to the other pages. I haven't yet figured out why since the file itself isn't being altered. Just the html. Does it have something to do with where js is outputting the final value for the dropdown? As always, appreciate any and all help.

Thanks!

2 Answers

I figured out what it was. I had the js links in my index file. Once I moved them to my footer.php file, the navigation was able to load to the other pages as well. Thanks, though.

Al3n MicL
Al3n MicL
6,364 Points

I guess this is why twbs templates always specify the .js links at the bottom of the page (and encourages you to do so) instead of the header. Didn't know why this is necessary if you use $(document).ready(function(){}); but now I see why... It makes sense.

Bill Hinostroza
Bill Hinostroza
19,273 Points

It's kind of hard to solve if there is no code but maybe your include is being routed to a different path? try doing ../inc/header.php or wherever your file is included.

If that is not the case then it most likely can be your js file.