navbar sub-menu doesn't function properly

I'm working on a website and in hizmetler.php page I have three section (2nd photo). When I click a title in that menu, the div related to that title shows and other divs hide. I want to add the same function to the sub-menu in navbar (1st photo). If I'm in hizmetler.php page, the navbar sub-menu works. But if I am another page when i click a title in that menu it takes me to hizmetler.php but to the default not the related div. And when I try to go there from index.php it doesn't go to even hizmetler.php. I am not that good at javascript/jquery so any help would be really appreciated.

This is navbar code:
<header>
    <a href="index.php" class="logo">
        <img src="assets/img/logo.png" alt="logo" height="50">
    </a>

    <input type="checkbox" id="menu-bar">
    <label for="menu-bar">Menü</label>

    <nav class="navbar">
        <ul>
            <li><a href="hizmetler.php">HİZMETLERİMİZ</a>
                <ul>
                    <li><a href="hizmetler.php" class="service-title" data-target="#section-one">ÇATI</a></li>
                    <li><a href="hizmetler.php" class="service-title" data-target="#section-two">ÇELİK</a></li>
                    <li><a href="hizmetler.php" class="service-title" data-target="#section-three">DİĞER</a></li>
                </ul>
            </li>
            <li><a href="#">REFERANSLARIMIZ</a></li>
            <li><a href="#">GALERİ</a></li>
            <li><a href="iletisim.php">İLETİŞİM</a></li>
        </ul>
    </nav>
</header>
Was this page helpful?