Jump to content

Hiding and Unhiding Filters


Recommended Posts

I want to allow the user to hide the filters (the whole left column), which should result the product list (center column) to expand to fill up to the hidden filter section, and vice versa if they plan to un-hide the filter.

 

Can someone guide me towards on how I should do this?

 

So far I have created a button, and not sure how to do the rest. This is the code I added to the category-count.tpl file.

<button class="btn btn-default button" id="toggleFilter">{l s='Hide Filters'}</button>

 

post-837418-0-26682000-1433265841_thumb.jpg

Link to comment
Share on other sites

Have it do something like

$('#left_column').toggle();

Then check if center column has a class like "expanded" , if not, use

$('#center_column').addClass('expanded');

Now you have to check the col-xs-whatever class it has, remove it and add col-xs-12 (and col-sm-12, and so on)

Link to comment
Share on other sites

This is the code I put in the global.js. It works perfectly on the first page in the category. But once I change from page 1 to page 2, the button doesn't anything anymore. 

$("#toggleFilter").on('click', function(){
	$("#left_column").toggle(display);
	$("#center_column").toggleClass( "col-sm-9 col-sm-12" );
});
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...