(function(){
window.onresize = function() {
doDich();
}
window.onload = function(){
doDich();
}
function doDich(){
if(window.matchMedia("(max-width: 560px)").matches){
add();
}
else
{
remove();
}
}
function add(){
document.querySelector('.menu').classList.add('resized');
document.querySelector('#nav-toggle').classList.add('notransporent');
link.addEventListener("click", function(event) {
event.preventDefault();
menu.classList.remove('resized');
menu.classList.add('show');
});
}
function remove(){
document.querySelector('.menu').classList.remove('resized');
document.querySelector('#nav-toggle').classList.remove('notransporent');
}
})();
window.onresize = function() {
if(window.matchMedia("(max-width: 560px)").matches){
doSomething();
}
}
window.onload = function(){
if(window.matchMedia("(max-width: 560px)").matches){
doSomething();
}
}
function doSomething(){
// что хотите делать при 560px
}