Satheesh
Satheesh

Reputation: 902

Change the position of div when re-showing it after hiding

Am creating a Facebook like chat application.(Say for example am chatting with 4 users) Loginuser : Me chattinguser-1:radmin chattinguser-2:admin chattinguser-3:orderingfacility chattinguser-4:Ref.Provider

if i close chatting with radmin the adjacent chat div will move by side of closed div.

Question

Am not disposing the div while user close chat.Just hide that div.so that the previous conversations remains in it while re-open it. My problem is if i re-open the closed div by $(div).show() method it opens at the position where it was created first.I need to re-open that div after all div's that present Am attaching a image describing the aboveenter image description here

Upvotes: 0

Views: 712

Answers (2)

NoBBy
NoBBy

Reputation: 497

Assuming the divs share a common parent you can try something like that:

$(div).show().appendTo($(div).parent());

I've included some example code here: http://jsfiddle.net/ujdRF/7/

Upvotes: 1

Christoph Eberhardt
Christoph Eberhardt

Reputation: 450

Maybe you can use the jquery function detach http://api.jquery.com/detach/ instead of just hiding it. Detach will remove the div from the DOM, but you can reattach the div container again, if you want to reuse it.

Upvotes: 1

Related Questions