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
aubrey _
1,190 PointsWhy isn't my JavaScript working?
function fade($ele) { $ele.fadeIn(1000).delay(3000).fadeOut(1000, function() { var $next = $(this).next('.quote'); fade($next.length > 0 ? $next : $(this).parent().children().first()); }); } fade($('.quoteLoop > .quote').first());
$(window).scroll(function() {
if ($(window).scrollTop() > 300) {
$('.main_nav').addClass('sticky');
} else {
$('.main_nav').removeClass('sticky');
}
});
// Mobile Navigation $('.mobile-toggle').click(function() { if ($('.main_nav').hasClass('open-nav')) { $('.main_nav').removeClass('open-nav'); } else { $('.main_nav').addClass('open-nav'); } });
$('.main_nav li a').click(function() { if ($('.main_nav').hasClass('open-nav')) { $('.navigation').removeClass('open-nav'); $('.main_nav').removeClass('open-nav'); } });
jQuery(document).ready(function($) {
$('.smoothscroll').on('click',function (e) { e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 800, 'swing', function () {
window.location.hash = target;
});
});
});
TweenMax.staggerFrom(".heading", 0.8, {opacity: 0, y: 20, delay: 0.2}, 0.4);
2 Answers
Hunter Thompson
6,958 Pointsdid you link it to the html
Jacob Mishkin
23,118 PointsI have no idea either, but I would suggest using the console.log to test and see what is working and what is not working.
aubrey _
1,190 Pointsaubrey _
1,190 Pointsyes