Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Jquery to filter div in bootstrap framework
    primarykey
    data
    text
    <p>Edited for more detail:</p> <p>I am designing a website using the twitter bootstrap framework. I want to filter out a couple div using jquery, so I did a research online and here is what I got.</p> <p>First comes the Filter button list (inside a div) with some css styling the ul list.</p> <pre><code>&lt;div class="row"&gt; &lt;div class="col-lg-8"&gt; &lt;ul id="filterOptions"&gt; &lt;li class="active"&gt;&lt;a href="#" class="all"&gt;All&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="UX"&gt;UX&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="UI"&gt;UI&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="Graphic"&gt;Graphic&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="Design"&gt;Design&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Then several nested div</p> <pre><code> &lt;div class="row"&gt; &lt;div id="ourHolder"&gt; &lt;div class="col-lg-6 UX"&gt; &lt;img src="img/DTB1.png"&gt; &lt;/div&gt; &lt;div class="col-lg-6 UI"&gt; &lt;img src="img/EDB1.png"&gt; &lt;/div&gt; &lt;div class="col-lg-6 Graphic"&gt; &lt;img src="img/STB1.png"&gt; &lt;/div&gt; &lt;div class="col-lg-6 Design"&gt; &lt;img src="img/MOV1.png"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Then the Jquery</p> <pre><code>$(document).ready(function() { $('#filterOptions li a').click(function() { var ourClass = $(this).attr('class'); $('#filterOptions li').removeClass('active'); $(this).parent().addClass('active'); if(ourClass == 'all') { $('#ourHolder').children('div.item').show(); } else { $('#ourHolder').children('div:not(.' + ourClass + ')').hide(); $('#ourHolder').children('div.' + ourClass).show(); } return false; }); }); </code></pre> <p>Somehow none of these buttons are working for me, if anyone can give me a hand here to tell me what am I missing, it will be very helpful!</p> <p>Thank you</p>
    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.
 

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