I've done a lot of research to try find a solution for this problem. I have a project where I am using parallax (magicScroll). I have a hamburger icon (where show/hide the menu), however this icon is black and I need change the color based on image background. So if I have a dark image as background the hamburger icon should be white and if I have a white background the icon should be black.
I've tried a lot of ways to do that, however I am using parallax. So I am having problems to write the function and I need help. My menu icon (.hamburger) is fixed at the header (position:fixed) and I have the sections below. The problem is: How identify the section in viewport (visible) and how add/remove the classe in my menu icon (.hamburger).
I was trying something like that:
var setMenu = function() {
if($('#section-3').inViewport()) {
$('.hamburger').addClass('navwhite')
} else {
$('.hamburger').removeClass('navwhite')
};
};
I was trying something like that to test, but without luck. :( Once my #section-3 hits the top of viewport, because the parallax, my ID never leaves this position, so I need help to learn how to do that.
Thanks in advance!