jQuery reversing my array of elements (or so it appears) -
My goal:
Find a div, slide all its child divs, then all of them Afterwards are the above, show one of those children through the slideshow.
jQuery snippet:
$ ('. ToggleTriggersWrapper .toggleTrigger'). Click (function () {var $ TogglePanesWrapper = $ (this) .clostest ('. ToggleTriggersWrapper'). Next ('. TogglePanesWrapper'). Eq (0); var idtoShow = '#' + this.className.match ( / Toggle \ - + + ($ (id: show). (": Hidden")) {$ togglePanesWrapper.children ('TogglePan'). SlideUp ('slow', function) (console.log ($ ( This)); if ($ (this) .is (": last-child")) (If there is last child, then we've closed them all, and now a new $ / $ Toggles PanesWrapper.children (IDtoShow ) .slideDown ('slow');}}}}}}}}}
problem:
What do I think Pen is that every Times when i I click on one of the Ni '.toggleTrigger' elements, then it finds the children of my $ Toggle Pence Vapor and then, one slides up for each, and after the last child is dropped, one of them My Element.
Then, like, all the child elements should be output in the console.log line order. But this is not what depends on .toggleTrigger I click on my console.log elements Is writing in a different order
The Uje know that it is not a lot, but based on the above, what could happen?
Is there any way to re-sort a jQuery object to match the object order in the DOM?
per request, here I am referring to HTML:
& Lt; Input type = "radio" name = "radiogram" value = "y" square = "toggle triggering toggle-pen 2" id = "relation-y" /> & Lt; Input type = "radio" name = "radiogram" value = "z" square = "toggle trigger toggle-pen 2" id = "relation-z" /> & Lt; / Div & gt; & Lt; Div class = "togglePanesWrapper" & gt; & Lt; Div class = "togglepay" id = "toggle-pen 1" & gt; Hello! & Lt; / Div & gt; & Lt; Div class = "togglepay" id = "toggle-pen 2" & gt; Yo! & Lt; / Div & gt; & Lt; / Div & gt;
The reason is different order because if you are doing animation on time with the slides If the element in the list is already hidden then jquery leaves the animation and jumps to the callback function, which does console.log ();
Comments
Post a Comment