I have searched it . I found some links .. But none of them helps me .
http://stackoverflow.com/questions/13974594/jquery-isotope-plugin-adding-inline-displaynone-cant-figure-out-why
http://stackoverflow.com/questions/10404933/jquery-isotope-library-with-html-tables
<div class="menu filter_open">
<span class="filter_by">
<em>Filter Awards By :</em>
</span>
<span data-filter="country_filter" class="drop-down">
Country
</span>
<span data-filter="continent_filter" class="drop-down">
Continent
</span>
<span data-filter="test_filter" class="drop-down">
Test
</span>
<span data-filter="odi_filter" class="drop-down">
ODI
</span>
<span data-filter="t20_filter" class="drop-down">
T20
</span>
</div>
<div class="filter_open filter_open2">
<div id="country_filter" class="filters">
<p>ghfgh</p>
</div>
<div id="continent_filter" class="filters">
<p>zxzcxzc</p>
</div>
<div id="test_filter" class="filters">
<p>zxczxcz</p>
</div>
<div id="odi_filter" class="filters">
<p>zxczxcxz</p>
</div>
<div id="t20_filter" class="filters">
</div>
</div>
My javascript code:
$(document).ready(function(){
var container = $('.filter_open');
$('.filter_open span.drop-down').click(function(){
var selector ='#'+ $(this).attr('data-filter');
container.isotope({
filter: selector
});
return false;
});
});
Necessary CSS are:
.filter_open2
{
width:100%;
height:4%;
border:1px solid;
}
.filters
{
display:none;
}
.isotope-item {
z-index: 2;
}
.isotope-hidden.isotope-item {
pointer-events: none;
z-index: 1;
}
When i click on country , it should show only the div element that matches with country_filter.. But when i click on a particular filter , everything will be disappeared. When i try to debug it using firebug , i figured out that inline styles are added automatically.. Why it is added automatically? How to solve this problem? Can you please help me?! This is the image before i click on a filter ! This is the picture after i click on country and the below part shows the inline styles that are added automatically
Use setAttribute("style","");
on the element after jquery isotope has finished adding inline styles to it.
Example for an element with any Id:
document.getElementById('#Id').setAttribute("style",""); // For any element Id
See this fiddle .It affects only inline styles.
Try the following code:
$(document).ready(function(){
var container = $('.filter_open');
$('.filter_open span.drop-down').click(function(){
var selector ='#'+ $(this).attr('data-filter');
container.isotope({
filter: selector
});
var ele = document.getElementsByClassName("drop-down");
for(i=0;i<ele.length;i++)
{
ele[i].setAttribute("style","");
}
return false;
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.