12345678910111213141516171819202122232425262728293031323334353637383940 |
- var active = {};
- function toggleCategory(elem) {
- var m = elem.getAttribute('class').match(/cat_[^ ]+/);
- if( m ) {
- var clz = '.' + m[0];
- console.log(clz);
- if( active[clz] ) {
- $(clz).removeClass('active');
- delete active[clz];
- } else {
- $(clz).addClass('active');
- active[clz] = true;
- }
- if( 0 == Object.keys(active).length ) {
- $('#photos').removeClass('active');
- } else {
- $('#photos').addClass('active');
- }
- }
- }
|