0

Tengo un problema, pues mi .resize() no responde. Necesito que el script se ejecute para que al rotar un dispositivo móvil se ajuste el tamaño.

Este es mi script:

$(window).bind("load", function() { 
    var winHeight = $(window).height();
        winHeightMobil = ($(window).height()) / 2;
        wWidth =  $(window).width();
        myElement = $('.Servicios');

    servFunction();
    function servFunction() {
        if (wWidth > 960) {
            myElement.height(winHeight)
        } else{
            myElement.height(winHeightMobil)
        }
    }
    $(window)
        .scroll(servFunction)
        .resize(servFunction)
});
2
  • En tu código no hay ningún evento llamado resize, solamente ejecutas una función al cargar la ventana
    – lromeraj
    el 16 may. 2017 a las 5:55
  • Gracias, suponía que con el $(window).scroll y $(window).resize cargaría, pero lo solucioné con un $(window).bind('resize', function()
    – JonhHdz
    el 16 may. 2017 a las 14:28

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.