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
Gabriel E
8,916 PointsWhy will this work in codepen but not my editor [Atom.io]?
This has been troubling me for a few days now. This is my codepen: http://codepen.io/xGabey/pen/WorXMN And as you can see, the collapsible nav works great. But then I put each code file (html, css, and js), in their proper files in my editor, I load jquery minified before my js file at the head in my html, and I remember to link each external file. Everything shows up, but the hide-on-scroll mechanic doesn't work. Does anyone have any ideas? Thanks,
~ Gabriel
1 Answer
Seth Kroger
56,416 PointsYou say, "I load jquery minified before my js file at the head in my html", but I see you're selecting DOM elements that come after the script without waiting for them to load first. You should use the standard practices of wrapping your code in $(document).ready() or placing your script at the bottom of the body
Gabriel E
8,916 PointsGabriel E
8,916 PointsMakes a lot more sense! Thanks for your help!