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
Ivan Tomicic
3,873 PointsfadeOut element on scroll not working?
Hello,
Can someone please help me, I need this done today and I'm freaking out...
What should I change to hide this PROJECT MANAGEMENT title when sidebar appears?
I managed to hide it when sidebar appears and then scroll down, but I need it hidden as soon as sidebar is shown?
Thank you so much!
1 Answer
Jeremy Menicucci
19,227 PointsIt seems like the javascript that you're using to animate the sidebar is sufficient to fadeOut and fadeIn the PROJECT MANAGEMENT title. The issue is you're event listening first and then jQuery is waiting for the scroll position to change to fadeOut the title. Just add,
function toggle( reveal ) {
isAnimating = true;
if( reveal ) {
classie.add( container, 'modify' );
$('.naslovservisa').fadeOut(200); // This
}
else {
$('.naslovservisa').fadeIn(200); // This
noscroll = true;
disable_scroll();
classie.remove( container, 'modify' );
}
Edit: then you can remove the jQuery content in titlehide.js, since that's irrelevant with the above code.
Ivan Tomicic
3,873 PointsIvan Tomicic
3,873 PointsWher exactly should I add this code?
Jeremy Menicucci
19,227 PointsJeremy Menicucci
19,227 PointsJust add it to the already existing code in the index.html file. Just add the code with the commented portions to the code that's already there. And then make sure you take out the code in the titlehide.js file so that's it's not conflicting with the above code.
Ivan Tomicic
3,873 PointsIvan Tomicic
3,873 PointsI tried to do so, added new <script> tag with code you provided and deleted titlehide.js but now PROJECT MANAGEMENT just stays on the screen all the time. Did that code worked for you in my file?
Jeremy Menicucci
19,227 PointsJeremy Menicucci
19,227 PointsYes the above code worked for me. You shouldn't have needed to add any new tags, just edit the code that's already there. Right below the closing div to your container div your code should look like this,
Does that help?
Ivan Tomicic
3,873 PointsIvan Tomicic
3,873 PointsYES!!! But I have no idea what I was doing wrong, thank you so much! You just saved me a lot of trouble...
Jeremy Menicucci
19,227 PointsJeremy Menicucci
19,227 PointsNo sweat, glad to help.