erknrio of Programming Guanches
5/9/2017 - 1:45 PM

Detecta cambios en la orientación del dispositivo.

Detecta cambios en la orientación del dispositivo.

window.addEventListener("orientationchange", function() {
    // Announce the new orientation number
    if (screen.orientation.type != "undefined") {
        if (screen.orientation.type.indexOf("portrait") >= 0) {
            alert("portrait");
        } else if(screen.orientation.type.indexOf("landscape") >= 0) {
            alert("landscape");
        }
    }
}, false);