I have a website which is adapted for mobile but in certain points of interruption or break I need to execute certain Javascript. Example:
I need that when the screen is greater than 992 px a'Click 'event is executed and if it is less than that resolution that nothing is executed or just sends an alert that indicates something.
What I tried was the following:
$(document).ready(function () {
$(window).resize(function () {
if ($(Window).width() >= 992) {
alert('Has cambiado el tamaño de la ventana');
$(".sidenav-trigger").click(function () {
alert("Handler for .click() called.");
$("body").toggleClass("menuclose");
});
} else {
alert("no entraste al if");
}
});
});
But for some reason it does not work for me ... who can help me how to make a certain script run depending on the screen of the device?