Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>in here</p> <pre><code>$('a.tag_filter', this).each(function(){ var curTag = $(this).attr('rel'); if(curTag == selectTag){ v++; return false; } }); </code></pre> <p>returning false inside of <code>$().each()</code> breaks the looping through each element in the wrapped set.</p> <p>From the <a href="http://docs.jquery.com/Core/each" rel="nofollow noreferrer">documentation</a></p> <blockquote> <p>Returning 'false' from within the each function completely stops the loop through all of the elements (this is like using a 'break' with a normal loop). Returning 'true' from within the loop skips to the next iteration (this is like using a 'continue' with a normal loop).</p> </blockquote> <p>Also, I would recommend caching <code>$(this)</code> inside of each <code>each()</code> in a local variable for performance instead of referencing it several times.</p> <p><strong>EDIT:</strong></p> <p>After looking at the code further, I think the following should do it</p> <pre><code>$('a.tag_filter').click(function(e){ // prevent the default anchor behaviour e.preventDefault(); var selectTag = $(this).attr('rel'); $('div.entry').each(function(i){ var $entry = $(this); // get an array of the anchor tag rel attributes var tagArray = []; $('a.tag_filter', this).each(function() { tagArray.push ($(this).attr('rel')); }); // if we can't find the selected tag in the entries tags if ($.inArray(selectTag,tagArray) == -1) { var leftPos = $entry.css("left"); var topPos = $entry.css("top"); $entry.fadeOut(1000, function(){ var nextLeftPos; var nextTopPos; $('div.entry:gt('+i+')').each(function(j) { var $laterEntry = $(this); nextLeftPos = $laterEntry.css("left"); nextTopPos = $laterEntry.css("top"); // for the first element, set top and left to the faded out element values if (j == 0) { $laterEntry.animate({ top: topPos, left: leftPos }); } // for later elements in the loop, ste the values to the previous element values else { $laterEntry.animate({ top: nextTopPos, left: nextLeftPos }); } }); }); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload