Smooth scroll for specific anchor tags not for all anchor tags

79
July 23, 2018, at 03:40 AM

I am trying to implement the smooth scroll when user click on the anchor tag then it will scroll and reach the target. it's working perfectly with all the anchor tag.

Now my issue is,

I have two tabs called as part1 and part2. There is no data in part1 but I have 3-4 anchor tags in the part2. I have to set a smooth scroll for that.

I don't want a smooth scroll when the user clicks on part1 or part2.

<div class="tabs">
            <ul class="tab_click">
                  <li class="current"><a href="#part1" >Part1</a></li>
                  <li><a href="#part2">part2</a></li>
            </ul>
      </div>

I need a smoth scroll when user click on the below anchor tag.

<ul>
          <li><a href="#about">About</a></li>
          <li><a href="#services">Services</a></li>
          <li><a href="#contact">Contact</a></li>
          <li><a href="terms.php">Terms</a></li>
        </ul>

Please check below link, I added my whole code here. https://codepen.io/Narendra_verma/pen/bjgXyK

Would you help me out in this issue

Answer 1

you can add main class for smooth scrolled link

at line 30

    $(document).on("click", ".main_tab a[href^=#]", function(e) {
READ ALSO
Leaflet AJAX - Call properties.description

Leaflet AJAX - Call properties.description

I currently have a geojson file with various storm tracking polygonsBelow is an example of the storm track code in geojson:

132
Page 2 div css should refresh if someone click a button placed on page 1 (jquery)

Page 2 div css should refresh if someone click a button placed on page 1 (jquery)

I would like to change css of a div on page 1 (Loaded on computer 2) if someone click a button on page two (Loaded on computer 1)

93
Disable swiping(idangero.us) when last item showd up

Disable swiping(idangero.us) when last item showd up

I'm using iDangerous swiper plugin, and i want to disable swiper when the last banner is showed in the screen

119
changing html style with form choice?

changing html style with form choice?

I have a HTML web page which needs to be modified

101