addClass only on index.php?

Hi, I have a script:

$(window).scroll(function() {
    var scroll = $(window).scrollTop();

    if (scroll >= 200) {
    } else {

The thing is I would want this to only apply to the mainpage (index.php) … Is this possible?

Is there a reason you can’t just put it on that page only?

Yes indeed, you can check if window.location.href or window.location.pathname contains the page you’re interested in.
You can get further information about window.location at