daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest May 16th, 2018 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. screen.height;
  2. screen.width;
  3.    
  4. var div= $('#div_SomeDivYouWantToAdjust');
  5. div.css("top", ($(window).height() - div.height())/2  + 'px');
  6.    
  7. var obj = $("#divID");
  8.  var halfsc = $(window).height()/2;
  9.  var halfh = $(obj).height() / 2;
  10.  
  11.  var halfscrn = screen.width/2;
  12.  var halfobj =$(obj).width() / 2;
  13.  
  14.  var goRight =  halfscrn - halfobj ;
  15.  var goBottom = halfsc - halfh;
  16.  
  17.  $(obj).css({marginLeft: goRight }).css({marginTop: goBottom });
RAW Paste Data
Top