title: Fix Popup to lift up smoothly
body: <p>I create a pop-up dialog box which lift up on left bottom while user scroll page.
  You can see it live here- <a href="http://uposonghar.com/jobs/odesk/daniel/new/" rel="nofollow">http://uposonghar.com/jobs/odesk/daniel/new/</a></p>
  
  <p>My problem is it does not smoothly lift up first time, then it is ok. Anyone please suggest any idea to fix it. Need to make smoothly lift up.</p>
  
  <p>My code</p>
  
  <pre><code>&lt;div id="scrolltriggered" style="width: 310px; left: 10px; bottom: 10px;"&gt;
  &lt;div id="inscroll"&gt;
      &lt;a href="#close" id="closebox"&gt;x&lt;/a&gt;&lt;a href="http://www.google.com" target="_blank"&gt;&lt;img src="images/buyersguide.png" alt="Free Resources" height="235" width="310"&gt;
       &lt;/a&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt; 
  var stb = {
  hascolsed: false,
  cookieLife: 7,
  triggerHeight: 30,
  stbElement: ""
  }; 
  &lt;/script&gt;
  </code></pre>
  
  <p>Javascript Code-</p>
  
  <pre><code>if (typeof stb === "undefined")
  var stb = {};
  jQuery(document).ready(function () {
  jQuery("#closebox").click(function () {
      jQuery('#scrolltriggered').stop(true, true).animate({ 'bottom':'-210px' }, 700, function () {
          jQuery('#scrolltriggered').hide();
          stb.hascolsed = true;
          jQuery.cookie('nopopup', 'true', { expires: stb.cookieLife, path: '/' });
      });
      return false;
  });
  
  stb.windowheight = jQuery(window).height();
  stb.totalheight = jQuery(document).height();
  stb.boxOffset = '';
  if (stb.stbElement != '') {
      stb.boxOffset = jQuery(stb.stbElement).offset().top;
  }
  jQuery(window).resize(function () {
      stb.windowheight = jQuery(window).height();
      stb.totalheight = jQuery(document).height();
  });
  
  jQuery(window).scroll(function () {
      stb.y = jQuery(window).scrollTop();
      stb.boxHeight = jQuery('#scrolltriggered').outerHeight();
      stb.scrolled = parseInt((stb.y + stb.windowheight) / stb.totalheight * 100);
  
  
      if (stb.showBox(stb.scrolled, stb.triggerHeight, stb.y) &amp;&amp; jQuery('#scrolltriggered').is(":hidden") &amp;&amp; stb.hascolsed != true) {
          jQuery('#scrolltriggered').show();
          jQuery('#scrolltriggered').stop(true, true).animate({ 'bottom':'10px' }, 700, function () {
          });
      }
      else if (!stb.showBox(stb.scrolled, stb.triggerHeight, stb.y) &amp;&amp; jQuery('#scrolltriggered').is(":visible") &amp;&amp; jQuery('#scrolltriggered:animated').length &lt; 1) {
          jQuery('#scrolltriggered').stop(true, true).animate({ 'bottom':-stb.boxHeight }, 700, function () {
              jQuery('#scrolltriggered').hide();
          });
      }
  });
  
  jQuery('#stbContactForm').submit(function (e) {
      e.preventDefault();
      stb.data = jQuery('#stbContactForm').serialize();
  
      jQuery.ajax({
          url:stbAjax.ajaxurl,
          data:{
              action:'stb_form_process',
              stbNonce:stbAjax.stbNonce,
              data:stb.data
          },
          dataType:'html',
          type:'post'
  
      }).done(function (data) {
              jQuery('#stbMsgArea').html(data).show('fast');
          });
  
      return false;
  });
  });
  
  (function(stb_helpers) {
  stb_helpers.showBox = function(scrolled, triggerHeight, y) {
      if (stb.isMobile()) return false;
      if (stb.stbElement == '') {
          if (scrolled &gt;= triggerHeight) {
              return true;
          }
      }
      else {
          if (stb.boxOffset &lt; (stb.windowheight + y)) {
              return true;
          }
      }
      return false;
  };
  stb_helpers.isMobile = function(){
      if (navigator.userAgent.match(/Android/i)
          || navigator.userAgent.match(/webOS/i)
          || navigator.userAgent.match(/iPhone/i)
          || navigator.userAgent.match(/iPod/i)
          || navigator.userAgent.match(/BlackBerry/i)
          ) {
          return true;
      }
      else return false;
  }
  })(stb);
  </code></pre>