Bind a handler for the resize event like so:

$(window).bind('resize', function() { ...});

Have a look at this thread:

http://groups.google.com/group/jquery-en/browse_thread/thread/4a00d513c63f5c00?pli=1

On Wed, Jan 6, 2010 at 11:08 AM, kevinkace <kevinacame...@gmail.com> wrote:
> Can you change a position of a div, based on screen size/resize with
> jquery? Something like
>
> if (browser>= sitecontainerwidth)
> {
> left:50%;
> margin-left: 20px;
> }
> else
> {
> left: 0%;
> margin-left: 600px;
> }
>
> I have a centered layout (div{margin: top auto;}) with a BG image.
> There's another div (with a background design) that needs to overlay
> on the BG, but off center.
>
> Figure of what the problem: 
> http://www.kacevisual.com/files/Div-difficulties.gif
>

Reply via email to