title: Redirect to a div on a different page with smooth scrolling?
body: <p><strong>Question Background:</strong></p>
  
  <p>I have a 2 page website. Both pages use the same <strong>masterlayout.cshtml</strong> page which features a Navbar. Within the Navbar is a number of links which scroll down to the relevant divs on page one based on their ID's.</p>
  
  <p><strong>The Issue:</strong></p>
  
  <p>When I access the second page I can no longer redirect to the specified divs from the Navbar links on the first page. This makes sense as the focus is no longer on the first page, but how do I get around this issue?</p>
  
  <p><strong>Code:</strong></p>
  
  <p>Here is the Navbar code with the div id's set, note the <code>data-id</code> attributes specifying which div to scroll to:</p>
  
  <pre><code>        &lt;div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"&gt;
              &lt;ul class="nav navbar-nav"&gt;
                  &lt;li&gt;&lt;a href="#" class="scroll-link" data-id="Welcome"&gt;Welcome&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#" class="scroll-link" data-id="features"&gt;Club&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#" class="scroll-link" data-id="About"&gt;About Us&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#" class="scroll-link" data-id="Location"&gt;Location&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href='@Url.Action("FutureEvents", "Events", new { pageNo = 1 })'&gt;Events&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt; 
  </code></pre>
  
  <p>Example of a div that is scrolled to:</p>
  
  <pre><code>        &lt;div id="Welcome"&gt;
               //HTML
          &lt;/div&gt;
  </code></pre>
  
  <p>The JQuery used to Scroll to the relevant div:</p>
  
  <pre><code>        function scrollToID(id, speed) {
            var offSet = 70;
            var obj = $(id).offset();
            var targetOffset = $(id).offset().top - offSet;
            $('html,body').animate({ scrollTop: targetOffset }, speed);
          }
  </code></pre>
  
  <p>If anyone can help with coming up with a viable solution to being able to call these id's from a different page that would be great.</p>