How to write a JS script for a specific page?

  • 0
    It is necessary to write javascript only for the header`a of the "Home" page, and for the rest of the pages - you need to make it so that it does not work. Please tell me how to implement this?

    Here is the code that is only needed for the "Home" page.

    $(window).scroll(function() {
        var height = $(window).scrollTop();
        if(height < 200){
        } else{
    JavaScript Anonymous, Jun 8, 2020

  • 1 Answers
  • 0
    if(window.location.href === ''){

    } catch(_){}
    Colton Ayers

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!