title: Bootstrap4 jQuery Horizontal Animation
body: <p>I have this code for horizontal page left to right animation. It was working fine but suddenly it stopped working. No changes were done. </p>
  
  <p><code>Page--3</code> link just stopped working and clicking on <code>Page--4</code> and <code>Page--5</code> links opens <code>Page--1</code> or <code>Page--2</code>.</p>
  
  <p><code>Page--1</code> link from navbar works
  <code>Page--2</code> link from navbar works</p>
  
  <p><code>Page--3</code> link from navbar does not open anythig</p>
  
  <p><code>Page--4</code> link from navbar opens <code>page--3</code> or <code>Page--2</code></p>
  
  <p><code>Page--5</code> sometimes works sometimes opens <code>Page--1</code> </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
  
      &lt;script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"&gt;&lt;/script&gt;
  
  
      &lt;!-- Bootstrap  CSS --&gt;
      &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"&gt;
  
      &lt;style type="text/css"&gt;
          html, body {
              height: 100%;
             /* background: linear-gradient(to left, #283048, #859398);*/
              overflow: hidden;
  
          }  
          
          .main{
              margin-top: 5%;
              margin-bottom: 0;
              margin-right: 0;
              mar`enter code here`gin-left: 0;
              
              width: 500%;
              height: 90%;
              
              /* Mandatory for horizontal scroll */
              overflow: hidden;
              display: inline-flex;
              white-space: nowrap;
              /* Mandatory for horizontal scroll */
  
          }
          
          .main .card{
              display: inline-block;
              background: transparent;
              
              height: 100%;
              width: 100%;
          }
          
          .c-toggler{
              border-color: white;
          }
          
          .navbar-dark .ham-icon{
             background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255, 1)'  stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
          }
          
      &lt;/style&gt;
  
  &lt;/head&gt;
  
      
  &lt;body&gt;
  &lt;div class="container container-navbar"&gt;
      &lt;nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark"&gt;
            &lt;a class="navbar-brand" href="#"&gt;NavBar&lt;/a&gt; &lt;!--Brand icon here --&gt;
            &lt;button class="navbar-toggler c-toggler" type="button" data-toggle="collapse" data-target="#navbar-div" aria-controls="navbar-div" aria-expanded="false" aria-label="Toggle navigation"&gt;
              &lt;span  class="navbar-toggler-icon ham-icon"&gt;&lt;/span&gt;
            &lt;/button&gt;
  
            &lt;div class="collapse navbar-collapse navbar-div" id="navbar-div"&gt;
              &lt;ul class="navbar-nav mr-3"&gt;
                &lt;li class="nav-item active"&gt;
                  &lt;a class="nav-link" href="#page1"  data-toggle="collapse" data-target=".navbar-collapse.show"&gt;Page--1 &lt;span class="sr-only"&gt;(current)&lt;/span&gt;&lt;/a&gt;
                &lt;/li&gt;
                &lt;li class="nav-item active"&gt;
                  &lt;a class="nav-link" href="#page2" data-toggle="collapse" data-target=".navbar-collapse.show"&gt;Page--2&lt;/a&gt;
                &lt;/li&gt;
                  &lt;li class="nav-item active"&gt;
                  &lt;a class="nav-link" href="#page3" data-toggle="collapse" data-target=".navbar-collapse.show"&gt;Page--3&lt;/a&gt;
                &lt;/li&gt;
                  &lt;li class="nav-item active"&gt;
                  &lt;a class="nav-link" href="#page4" data-toggle="collapse" data-target=".navbar-collapse.show"&gt;Page--4&lt;/a&gt;
                &lt;/li&gt;
                &lt;li class="nav-item active"&gt;
                  &lt;a class="nav-link" href="#page5" data-toggle="collapse" data-target=".navbar-collapse.show"&gt;Page--5&lt;/a&gt;
                &lt;/li&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
      &lt;/nav&gt;
  &lt;/div&gt;    
  
  &lt;div class="container-fluid main"&gt;
    &lt;div class="card page1" id="page1"&gt;&lt;h2&gt;Page1&lt;/h2&gt;&lt;/div&gt;
    &lt;div class="card page2" id="page2"&gt;&lt;h2&gt;Page2&lt;/h2&gt;&lt;/div&gt;
    &lt;div class="card page3" id="page3"&gt;&lt;h2&gt;Page3&lt;/h2&gt;&lt;/div&gt;
    &lt;div class="card page4" id="page4"&gt;&lt;h2&gt;Page4&lt;/h2&gt;&lt;/div&gt;
    &lt;div class="card page5" id="page5"&gt;&lt;h2&gt;Page5&lt;/h2&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;!-- Bootstrap  and jQuery Scripts--&gt;
  &lt;script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"&gt;&lt;/script&gt;
  
  &lt;script&gt;
            $(document).ready(function(){
              $("body").css("overflow" , "hidden");
              $('a[href^="#page"]').on('click' , function(){
                  event.preventDefault();
                  
                  // Horizontal Scroll
                  $('html, body').animate({scrollLeft: $($(this).attr('href')).offset().left} , 1000);        
               });
            });
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>