title: jQuery - How to scroll the page to a div if div dynamically moves?
body: <p>Currently I am creating a website mainly using a mix of PHP, SQL, and JS. I use the JS to dynamically pull up new data using PHP and SQL. The current issue I am running into is that I have a button that when clicked will have the page scroll to the current DIV every 2.5 seconds based on offset. The issue is the function does not find the NEW offset once the element has moved. </p>
  
  <p><strong>Code snippets:</strong></p>
  
  <p>...</p>
  
  <pre><code>$(".button").click(function() {
              $message_focus = "TRUE";
              $to_focus=($(".focus_on_this").offset().top);
          });
  </code></pre>
  
  <p>...</p>
  
  <pre><code>if ($message_focus = "TRUE") {
          $("html, body" ).animate( { scrollTop: ($to_focus) },{ queue:false, duration:750 } );
      }
  </code></pre>
  
  <p>...</p>
  
  <p>That is where the main issue is. It all works fine, though it only goes to the initial div's starting location. Thank you in advance for your response.</p>