Note that there are some explanatory texts on larger screens.

plurals
  1. POApplying special effects to the selected filter
    primarykey
    data
    text
    <p>Ok so I’m using the quicksand jquery filter. now I want to add a particular effect (which I’ve typed in javascript) to all the images when any of the filters are selected. The filter list is as follows:-</p> <pre><code>&lt;ul class="filter"&gt; &lt;li class="current all"&gt;&lt;a href="#"&gt;Fred&lt;/a&gt;&lt;/li&gt; &lt;li class="daisy"&gt;&lt;a href="#"&gt;daisy&lt;/a&gt;&lt;/li&gt; &lt;li class="richard"&gt;&lt;a href="#"&gt;richard&lt;/a&gt;&lt;/li&gt; &lt;li class="ama"&gt;&lt;a href="#"&gt;ama&lt;/a&gt;&lt;/li&gt; &lt;li class="santy"&gt;&lt;a href="#"&gt;santy&lt;/a&gt;&lt;/li&gt; &lt;li class="washington"&gt;&lt;a href="#"&gt;washington&lt;/a&gt;&lt;/li&gt; &lt;li class="deuces"&gt;&lt;a href="#"&gt;deuces&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>So I’m using the following syntax to determine the selected filter and work some jquery 'magic' from there.</p> <pre><code> $(".filter a").click(function(e){ $(".filter li").removeClass("current"); // Get the class attribute value of the clicked link var $filterClass = $(this).parent().attr("class"); if ( $filterClass == "all" ) { var $filteredPortfolio = $portfolioClone.find("li"); } else { var $filteredPortfolio = $portfolioClone.find("li[data-type~=" + $filterClass + "]"); $filteredPortfolio.addClass("row3"); } </code></pre> <p>Now to add the special effect to the all the images of the selected filter (say photography), I added this code <code>$("$filteredPortfolio").addClass("row3")</code> which you see on the last line basically because the effect works on all elements with the class <code>row3</code> yet when I debug this in my browser, it fails to work. What am I doing wrong? I still consider myself a jquery newbie so please pardon me if the answer is obvious.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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