How can I make this code only work on the main page of a WordPress site?
jQuery(document).ready(function($) {
var scrolled;
window.onscroll = function() {
scrolled = window.pageYOffset || document.documentElement.scrollTop;
if (scrolled > 400) {
$(".mega-menu-link").css({
"color": "rgba(102,102,102,0.85)"
})
}
if (400 > scrolled) {
$(".mega-menu-link").css({
"color": "rgba(255,255,255,0.8)"
})
}
}
});