For that you still add the HEAD class but use this script
$(function() {
$(window).on("scroll", function() {
if($(window).scrollTop() > 50) {
$("#menu-ul").addClass("black");
} else {
$("#menu-ul").removeClass("black");
}
});
});
</script>
What that does is instead of going through all the classes it only looks for the menu ID
which makes it much more efficient. Plus you already have that ID if you used my tutorial, (It's on the container).