I am having trouble getting my filtered table to change views at the same time. You can see it here in this jsfiddle. Ignore the overlapping text for now.
What I want to do is have it change to compact or full view when the button is pressed once. This somehow works when it is the button is clicked twice.. which isn't correct.
Any ideas? I am not great at jquery but I can get things to work
See fiddle and functions at bottom.
var $timeBlock = $('.timeBlock'),
$checkboxes = $('#filters input');
$timeBlock.isotope({
itemSelector: '.item'
});
$checkboxes.change(function(){
var filters = [];
// get checked checkboxes values
$checkboxes.filter(':checked').each(function(){
filters.push( this.value );
});
// ['.red', '.blue'] -> '.red, .blue'
filters = filters.join(', ');
$timeBlock.isotope({ filter: filters });
});
$('#shuffle').click(function(){
$timeBlock.isotope('shuffle');
});
var $items = $timeBlock.children();
$("#isotope-reset").click(function(){
reset();
});
$('#compact').click(function () {
$('.item').animate({width: "30%"}, 500);
$('.item').animate({height: "35px"}, 500);
reset();
});
$('#full').click(function () {
$('.item').animate({width: "455px"}, 500);
$('.item').animate({height: "80px"}, 500);
reset();
});
function reset() {
$('input[type=checkbox]').attr('checked',false);
$timeBlock.isotope({
filter: '*'
});
}