Note that there are some explanatory texts on larger screens.

plurals
  1. POUse jquery + checkbox to filter post
    primarykey
    data
    text
    <p>I use a plugin called quicksand in my wordpress theme this plugin load the post in the choosen category. Now I have added custom taxnomies/ custom field values to every post, and I want to be able to sort my post's based on them.</p> <p>Since Im really new to jquery I really don't know were to start. I understand that my script listens for "link" clicks. I also understand that it checks the class of the link clicked and sends this to my quicksand script for it to determine what to show, and then animate i smoothly.</p> <p>Here's the script:</p> <pre><code>$(document).ready(function(){ // Blur images on mouse over $(".portfolio a").hover( function(){ $(this).children("img").animate({ opacity: 0.75 }, "fast"); }, function(){ $(this).children("img").animate({ opacity: 1.0 }, "slow"); }); // Clone portfolio items to get a second collection for Quicksand plugin var $portfolioClone = $(".portfolio").clone(); // Attempt to call Quicksand on every click event handler $(".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 + "]"); } // Call quicksand $(".portfolio").quicksand( $filteredPortfolio, { duration: 800, easing: 'easeInOutQuad' }, function(){ // Blur newly cloned portfolio items on mouse over and apply prettyPhoto $(".portfolio a").hover( function(){ $(this).children("img").animate({ opacity: 0.75 }, "fast"); }, function(){ $(this).children("img").animate({ opacity: 1.0 }, "slow"); }); }); $(this).parent().addClass("current"); // Prevent the browser jump to the link anchor e.preventDefault(); }) }); </code></pre> <p>I use this plugin on my wordpress site and i have managed to modify it to show post's in the right category. How can i make it look for checked checkboxes? This is how my source code looks like.</p> <pre><code>&lt;!-- //Setting up the args variable --&gt; &lt;div id="wrap"&gt; &lt;dl class="group"&gt; &lt;dt&gt;Filter:&lt;/dt&gt; &lt;dd&gt; &lt;!-- Setting up the list id --&gt; &lt;ul class="filter group"&gt; &lt;!-- Adding all option as it will always be there, theres always an all! --&gt; &lt;li class="current all"&gt;&lt;a href="#"&gt;All&lt;/a&gt;&lt;/li&gt; &lt;!-- Doing the if to dynamicly add all the categories --&gt; &lt;li class="Stenar"&gt;&lt;a href="#"&gt;Stenar&lt;/a&gt;&lt;/li&gt; &lt;li class="logos"&gt;&lt;a href="#"&gt;logos&lt;/a&gt;&lt;/li&gt; &lt;li class="web"&gt;&lt;a href="#"&gt;web&lt;/a&gt;&lt;/li&gt; &lt;li class="web"&gt;&lt;a href="#"&gt;web&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/dd&gt; &lt;/dl&gt; &lt;ul class="portfolio group"&gt; &lt;li class="item" data-id="1" data-type="Stenar"&gt; &lt;a href="http://bugaboodonkey.info/2012/01/utanfor/" rel="prettyPhoto [portfolio]"&gt;&lt;img width="140" height="130" src="http://bugaboodonkey.info/wp- content/uploads/2012/01/73e3fb17.gif" class="attachment-post-thumbnail wp-post-image" alt="73e3fb17" title="73e3fb17" /&gt;&lt;/a&gt; &lt;!-- Hämtar custom taxonomy --&gt; &lt;!-- Hämtar Customvalue baserat på key --&gt; &lt;!-- &amp;nbsp;&amp;nbsp; Pris: --&gt; &lt;/li&gt; &lt;li class="item" data-id="2" data-type="logos"&gt; &lt;a href="http://bugaboodonkey.info/2012/01/testar-3/" rel="prettyPhoto[portfolio]"&gt;&lt;img width="140" height="130" src="http://bugaboodonkey.info/wp-content/uploads/2012/01/73e3fb17.gif" class="attachment-post-thumbnail wp-post-image" alt="73e3fb17" title="73e3fb17" /&gt;&lt;/a&gt; &lt;!-- Hämtar custom taxonomy --&gt; &lt;!-- Hämtar Customvalue baserat på key --&gt; &lt;!-- &amp;nbsp;&amp;nbsp; Pris: --&gt; &lt;/li&gt; &lt;li class="item" data-id="3" data-type="web"&gt; &lt;a href="http://bugaboodonkey.info/2012/01/testar-1/" rel="prettyPhoto[portfolio]"&gt;&lt;img width="140" height="58" src="http://bugaboodonkey.info/wp-content/uploads/2011/06/bugaboo-donkey1-475x198.jpg" class="attachment-post-thumbnail wp-post-image" alt="Bugaboo Donkey" title="bugaboo donkey" /&gt;&lt;/a&gt; &lt;!-- Hämtar custom taxonomy --&gt; &lt;!-- Hämtar Customvalue baserat på key --&gt; &lt;!-- &amp;nbsp;&amp;nbsp; Pris: --&gt; &lt;/li&gt; &lt;li class="item" data-id="4" data-type="web"&gt; &lt;a href="http://bugaboodonkey.info/2012/01/kattsand/" rel="prettyPhoto[portfolio]"&gt;&lt;img width="140" height="58" src="http://bugaboodonkey.info/wp-content/uploads/2011/06/bugaboo-donkey1-475x198.jpg" class="attachment-post-thumbnail wp-post-image" alt="Bugaboo Donkey" title="bugaboo donkey" /&gt;&lt;/a&gt; &lt;!-- Hämtar custom taxonomy --&gt; &lt;!-- Hämtar Customvalue baserat på key --&gt; &lt;!-- &amp;nbsp;&amp;nbsp; Pris: --&gt; &lt;/li&gt; &lt;/ul&gt; &lt;!-- &lt;li data-id="id-1" data-type="hannah"&gt; &lt;a href="images/hannah_yg.jpg" rel="prettyPhoto[portfolio]"&gt; &lt;img src="images/hannah_yg_thumb.jpg" /&gt; &lt;/a&gt; &lt;/li&gt; --&gt; &lt;/div&gt; </code></pre>
    singulars
    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