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 trialTony B
Front End Web Development Techdegree Student 10,702 PointsBroken? I'm super stuck!
I've straight spent over a couple of hours on this. I think because it should be so simple. I have a feeling that it is buggy and doesn't work anymore. The last posts on the forum for this are 2+ years old, and the last commit for stickyjs was a few years ago.
I'm not sure how to make the question go in the proper forum with all the other Q&As for the vid: https://teamtreehouse.com/library/using-jquery-plugins/add-a-sticky-navigation-bar/the-plugin-challenge-solution#questions
I deleted my workspace and opened up a fresh one. In 'work.html' on line 36 you have to change the class to 'work':
<h5 class="work">Want us to work on your project?</h5>
In 'js>animsition>main.js' you should just have to add this to the bottom:
$('.work').sticky({
topSpacing: 60
});
Then the text should sticky under the header as you scroll. I can't get it work, and I've tried it locally and in chrome and firefox. I have to fix it it's driving me crazy!
PS: There's something wrong with me since I do like these getting stuck problems. That was one of the fastest couple of hours I've had in web dev so far. I'm curious, is jquery not being updated since we don't need it for browser compatibility anymore? It's weird that the last commit was so long ago for stickyjs, and I heard jquery is dying. Do plugins just break as jquery updates is my guess?
Tony B
Front End Web Development Techdegree Student 10,702 PointsBrian Jensen figured it out! I was so curious how he knew to add the getWidthFrom and responsiveWidth, and he said it was from Dave. I never made it to the part where he added it at the end of the video. I think maybe it was already cached so that's why it worked on just the h5 work class before he added the widths.
The solution is below, but now I'm curious how Dave knew to go about the main.js this way? I started looking at the stickyjs documentation, and it is super convoluted compared to the vid. Is there a way I would be able to figure this out without the video?
Brian Jensen 9 minutes ago Hiya @Tony! Within your original workspace snapshot, in main.js: • Change line 9 from this: $('.header').sticky(); To this: $('.header').sticky({ getWidthFrom: '.container', responsiveWidth: true }); • Change line 19 from this: $('.h5-work').sticky(); To this: $('.h5-work').sticky({ topSpacing: 60, getWidthFrom: '.container', responsiveWidth: true });
2 Answers
Steven Parker
231,271 PointsAfter you post a snapshot of your workspace we can take a look. But in the meantime, where did you see the rumor of jQuery "dying"? A lot of popular apps, APIs and frameworks rely on it. My guess is that it gets updated less frequently because it is very stable, and popular browsers are better at adhering to standards now.
Tony B
Front End Web Development Techdegree Student 10,702 PointsIt's working now. Jquery dying I've heard on treehouse slack server and other random places. It seems like it's not updated as much.i know it's still prevalent, but I was thinking it was kind of like php. Good to know but ten years from now it will be in major decline.
Steven Parker
231,271 PointsKind of a long prediction, but I suppose if you're confident in it then anyone not planning to do any development until 10 years from now could skip learning it.
Tony B
Front End Web Development Techdegree Student 10,702 PointsI'm conservative, but people years ago were asking if jquery is dead on Google search results. I guess major decline in two years and obsolete in 5 years might happen, but I like learning it either way. People were and are saying the same about php but I want to do that next spring.
Steven Parker
231,271 PointsSteven Parker
231,271 PointsPlease make a snapshot of your workspace and post the link to it here.