.gruppi-toggle.hidden {
display: none;
}
(function(){
function handler(event, method, current, target) {
current['on' + event] = current.classList[method].bind(target || current, 'hidden');
};
var btn = document.querySelectorAll('.gruppi-toggle'),
block = document.querySelectorAll('.speciali-gruppi-window'),
screenIsMin = window.screen.width < 960,
i, method = screenIsMin ? 'toggle' : 'remove';
for(i = 0; i < btn.length; i++) {
handler('click', method, btn[i], block[i]);
if(!screenIsMin) {
handler('mouseleave', 'add', block[i]);
}
}
})();
|