jquery - How to position a div dynamically below another? -


I use jQuery to find out the status of a div ( #olddiv ) Trying to do so, I can use that situation to do another div ( #newdiv ) below it. The correct boundaries of 2 divs are aligned (right border)

I #olddiv to the right and the right places to give them the #newdiv top and right borders I am trying to use it as I have used this code, but it is not working. Any thoughts that I am doing wrong?

var correct = $ ('# old day'). Event (). Right; Var top = $ ('# olddiv'). Event (). bottom; $ ('# Newdiv') CSS ('top', right); $ ('# Newdiv') CSS ('right', top);

In addition to this, I'm not sure if I have status , then what do I need? I think this can be done with status or offset , but I'm not sure:

  $ ('# ID '). $ Left ('# id'). Offset (). Left  

Thanks

I dynamically position the elements Use offset () to try it:

  var offset = $ ('# olddiv'). Offset (); Var height = $ ('# olddiv') height (); Var width = $ ('# olddiv'). Width (); Var top = offset.top + height + "px"; Var correct = offset Left + width + "px"; $ ('# ID') CSS ({'position': 'absolute', 'right': right, 'top': top});  

Also do not forget to bind the event window.onresize , if you need it when the user changes the window size.

Update: One more idea - is it to be deployed altogether? Why not divide only after the second in the dome?

  $ ('# olddiv'). ($ ('# Id') .html ());  

Then make sure they are the same width.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -