find on page neighbouring siblings jquery?

Posted by Stefan on Stack Overflow See other posts from Stack Overflow or by Stefan
Published on 2011-03-19T08:06:37Z Indexed on 2011/03/19 8:10 UTC
Read the original article Hit count: 182

Filed under:
|
|

ok i've been searching for an answer to this (if there even is one) with no luck

i have a succession of div elements as shown in the pic bellow:

http://i61.photobucket.com/albums/h46/DrAcOliCh_2006/untitled-1.jpg?t=1300520458

the blue background is the absolute parent of the orange divs which are also siblings

the DOM is not quite organized according to how the orange elements appear on the page because they are all draggable (i used jquery UI) and i moved them around inside the parent, yet, as some know, the DOM doesn't get reorganized when i move draggable elements around, so basically the siblings structure remains the same inside the DOM

what i kinda need (again if that is even possible) is to determine the immediate on page neighbouring siblings of eachother; in other words, say we take that "FlashBanner" element which, on page, has the "Logo", the "Search" and the "ShoppingBasket" elements as immediate top siblings and the "Categories" and "Content" elements as immediate bottom siblings (and no left or right siblings)

i have a manual solution to this, that is to pre-specify the on page neighbouring siblings for each element through a series of form fields and stuff (another story and another wall of text to explain), but that is not important atm as i want to know if it can be done automatically (i.e tell jquery to find them for me)

appreciate any help, even an "it can't be done automatically", and thank you for your time

hope this doesn't sound to ambiguous (or silly for that matter) and why i need to do that don't ask :P wall of text to explain

cheers :)

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about user-interface