SCroll top and popup center


/ Published in: jQuery
Save to your folder(s)

Popup center and scroll top script


Copy this code and paste it in your HTML
  1. $( 'html, body' ).animate( { scrollTop: 0 }, 0 );
  2. var winH = $(window).height();
  3. var winW = $(window).width();
  4. var centerDiv = $("#"+container_id);
  5. centerDiv.css('top', (winH/2-centerDiv.height()/2) + 100);
  6. centerDiv.css('left', winW/2-centerDiv.width()/2);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.