skip to Main Content

I am using a template built with bootstrap that has some tabs on it. I would like to create a link on a my to make the page scroll to a specific tab. For example, I want that link:

<a href="tab-cus-1">Shipping Information</a>

to redirects to:

<div id="tabs" class="htabs">
  <a href="#tab-description" class="selected">Description</a>
  <a href="#tab-review" id="product-reviews-a" class="">Reviews</a>
  <a href="#tab-cus-1">Shipping</a>
  <a href="#tab-cus-2">Why buy from us?</a></div>

<div id="tab-cus-1" class="tab-content"></div>

my website: link

Thanks in advance

2

Answers


  1. To do this you need to have <section> instead of <div> and all the attributes stay the same.

    You can do <a href="#tab-cus-1"></a>. If it doesn’t work please tell me.

    Hope it works!

    Login or Signup to reply.
  2. @Ayaan code is working too… its good.

    But there should be more content so that the focus on click will be seen:

    <div id="tabs" class="htabs">
      <a href="#tab-description" class="selected">Description</a>
      <a href="#tab-review" id="product-reviews-a" class="">Reviews</a>
      <a href="#tab-cus-1">Shipping</a>
      <a href="#tab-cus-2">Why buy from us?</a>
    </div>
    
    <div id="tab-review">
    Why do we use it?
    
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    
    
    Why do we use it?
    
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    </div>
    
    Why do we use it?
    
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    
    <div id="tab-cus-1" class="tab-content">
    <b>Focus Shipping ...</b>
    
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    
    </div>
    
    <div id="tab-cus-2">
    
    <b>Why buy from us?</b>
    
    
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    </div>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search