Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I refresh auto margins when I resize an element using Javascript?
  2. <div id="content" style="margin-left:auto;margin-right:auto;width:240px">
  3.   <p>Lots of text</p>
  4. </div>
  5.        
  6. $("#content").width(480);
  7.        
  8. <div id="content" style="margin-left:auto;margin-right:auto;width:240px;border:1px solid red;text-align:center">
  9.   <p>Click here</p>
  10.        
  11. $('p').click(function(){$("#content").width(480)})