简体   繁体   中英

How do the link the navigation menu to the same page with different contents?

I'm setting up a website for my school project and want to link different products of category from database in the same page. How do I link to the same page but get different content when i click different hyperlink on the navigation menu?

If you website and you can create different post then you have link only post or page link in your navigation bar display menu.

<a href="your post will be here"></a>

you can post here any other website post link.

My you have other option make one post with all your product as category in div attribute make all in css display none

Only one category leave to normal view.

Then create same link with js query function for each your category with different id.

You will get all your product on one page.

  <div id="myLinks" style=" display: none;"> Your all details for category will be here</div>

 <a href="#" class="active" onclick="myFunction()" >books</a>

 <script>
function myFunction() {
  var x = document.getElementById("myLinks");
 if (x.style.display === "none") {
   x.style.display = "block";
 } else {
   x.style.display = "none";
 }

}

Hope you will find it helpful

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM