mardi 6 juin 2017

if statement including hover() and window width

i'm certain new with all this I trying to fix my code to be disabled on small screens, this is my code that i want it to work:

$( document ).ready(function() {

$('.item').hover(
    function(){
        $(this).find('.hello').slideDown(250); //.fadeIn(250)
    },
    function(){
        $(this).find('.hola').stop(true, false).slideUp(250); //.fadeOut(205)
    }
);

});


i guess that i need like a if statement or something like that, but i dont know how to apply it... i was doing something like this:

$(document).ready(function(){
$(".item").hover(function(){
    if ($(window).width() < 480) {
      function(){
          $(this).find('.hello').slideDown(250); //.fadeIn(250)
      },
      function(){
          $(this).find('.hello').slideUp(250); //.fadeOut(205)
      }
    }
});

}); but it dont work, help please

Aucun commentaire:

Enregistrer un commentaire