How to avoid CSS conflict using jquery?

Posted by user2885137 on Stack Overflow See other posts from Stack Overflow or by user2885137
Published on 2013-10-28T09:47:09Z Indexed on 2013/10/28 9:53 UTC
Read the original article Hit count: 205

Filed under:
|
|

I am experiencing a CSS conflict issue. Here are the details:

I have a search results page in which products are shown in grid format. The CSS for that is grid search results is "product-grid.css" which is included header of the page. On this page I have button which when clicked shows the search results in list format. The css for list format is "product-list.css" which is also included in head tag of the page.

Now the HTML guy has made the name of classes to be same in both product-grid.css and product-list.css.

What I want is that when I am viewing the page in grid style only product-grid.css should apply to respective portion of the page. And when I am viewing the page in list format then product-grid.css should be disabled and product-list.css should apply on whole page.

I have tried enabling and disabling css files using jquery but may be I am doing something wrong. Also when the page loads both css files are active in head tag and due to conflict in classes names the page is malformed even without shifting to other view.

Any help what should I do?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html