別ページへのアンカーリンクがうまくいかない

遷移先ページへ以下を記述する

$(window).load(function () {
  var lochref = window.location.href;
  if (lochref.indexOf("#") > -1) {
    var anchor = lochref.slice(lochref.indexOf("#"));
    window.setTimeout(function () {
      $("body, html").animate(
        {
          scrollTop: $(anchor).offset().top,
        },
        1
      );
    }, 1);
  }
});

よくある質問

/* ===============================================
  # faq
  =============================================== */

jQuery(function ($) {
  $(".question").on("click", function () {
    /*クリックでコンテンツを開閉*/
    $(this).next().slideToggle(200);
    /*矢印の向きを変更*/
    $(this).toggleClass("open", 200);
  });
});

/* ===============================================
  # faq 排他処理
  =============================================== */

$(function() {
		$('.question').click(function() {
			$(this).toggleClass('open');
			$(this).next().slideToggle();
			$('.question').not($(this)).next().slideUp();
			$('.question').not($(this)).removeClass('open');
		});
	});

100vhスクロールしたらclass付与

$(window).scroll(function() {
        var height = $(window).height();
        if ($(window).scrollTop() > height) {
            $('header').addClass('is-show');
        } else {
            $('header').removeClass('is-show');
        }
    });

タブ

HTML

<div class="tab-group">
    <div class="tab-area">
        <div class="tab active">
            タブ1
        </div>
        <div class="tab">
            タブ2
        </div>
        <div class="tab">
            タブ3
        </div>
    </div>
    <div class="content-area">
        <div class="content show">
            タブ1コンテンツ
        </div>
        <div class="content">
            タブ2コンテンツ
        </div>
        <div class="content">
            タブ3コンテンツ
        </div>
    </div>
</div>

SCSS

.tab-group {
    .tab-area {
        display: flex;

        .tab {
            align-items: center;
            border: 1px solid #000;
            color: #000;
            cursor: pointer;
            display: flex;
            justify-content: center;
        }

        .tab.active {
            background-color: #000;
            color: #fff;
        }
    }

    .content-area {
        .content {
            display: none;
        }

        .content.show {
            display: block;
        }
    }
}

jQuery

$(function () {
  let tabs = $(".tab");
  $(".tab").on("click", function () {
    $(".active").removeClass("active");
    $(this).addClass("active");
    const index = tabs.index(this);
    $(".content").removeClass("show").eq(index).addClass("show");
  });
});