{"id":549,"date":"2012-03-28T15:36:32","date_gmt":"2012-03-28T15:36:32","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=549"},"modified":"2012-03-28T15:36:42","modified_gmt":"2012-03-28T15:36:42","slug":"jquery-nextuntil-sluggish","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/jquery-nextuntil-sluggish\/","title":{"rendered":"jQuery nextUntil sluggish"},"content":{"rendered":"<p>One of jQuery&#39;s latest traversal functions, nextUntil, adds enormous value for anyone using expand collapse functionality in their sites.<\/p>\n<p>By allowing you to &quot;select&quot; all elements up until a given element, this short little block of code gives us just about everything we need for expand\/collapse:<\/p>\n<p><code>$(&#39;.expand-collapse&#39;).children(&#39;h3&#39;).nextUntil(&#39;h3&#39;).hide();<br \/>\n\t$(&#39;.expand-collapse&#39;).children(&#39;h3&#39;).click(function() {<br \/>\n\t&nbsp;&nbsp;&nbsp; $(this).nextUntil(&#39;h3&#39;).slideToggle(&#39;fast&#39;);<br \/>\n\t});<\/code><\/p>\n<p>But, if you find yourself using an older version of jQuery, say 1.4, you mind find that nextUntil function is a little on the &quot;heavy&quot; side in terms of execution time, especially in Internet Explorer 8.0 and prior.<\/p>\n<p>The solution, simple, just upgrade jQuery. I&#39;ve found the the latest 1.7 branch has greatly improved the execution time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of jQuery&#39;s latest traversal functions, nextUntil, adds enormous value for anyone using expand collapse functionality in their sites. By allowing you to &quot;select&quot; all&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[5],"tags":[9,152],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/549"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=549"}],"version-history":[{"count":2,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/549\/revisions"}],"predecessor-version":[{"id":551,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/549\/revisions\/551"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}