Skip to content

Instantly share code, notes, and snippets.

@NicoHinderling
Created August 25, 2016 12:54
Show Gist options
  • Save NicoHinderling/9a4310176d7c9fe7b3d7cc3f120ec0e5 to your computer and use it in GitHub Desktop.
Save NicoHinderling/9a4310176d7c9fe7b3d7cc3f120ec0e5 to your computer and use it in GitHub Desktop.
var sections = [["home", 0], ["schedule", 500], ["faq", 1200], ["apply", 2000], ["sponsors", 3000], ["contact", 3000]];
function removeCircle(i) {
console.log(i);
$('.' + $(this).sections[i][0] + 'ProgressCircle').css('background', "transparent");
}
$(window).scroll(function() {
var height = $(window).scrollTop();
// console.log(height);
for (i = 0; i < sections.length; i++) {
if(height >= sections[i][1]) {
$('.' + sections[i][0] + 'ProgressCircle').css('background', "#EF6262");
$('.' + sections[i][0] + 'ProgressLink').css('background-position', "left");
} else {
// removeCircle(i);
console.log(sections.length);
setTimeout(function() { console.log(i); console.log(sections[i][0]); removeCircle(i); }, 2000);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment