How do you check the screen width on jQuery?



  • We need to do something like a sss request copper, but only in jQuery. I've been through a lot of options, but at some point, animation just doesn't work. How do you make animation work only when the screen width is more than 800px? Or how do you want a resize test?

    var logoIcon = $('.account-icon')
    var logoText = $('.account-title')
    var body = $('.account-body')
    

    body.mouseenter(function(){
    $(logoIcon).animate({ "left": "8px", "opacity": "1" }, "600" );
    }).mouseleave(function(){
    $(logoIcon).animate({ "left": "24px", "opacity": "0" }, "600" );
    })

    body.mouseenter(function(){
    $(logoText).animate({ "left": "8px" }, "600" ).css({"color": "#fbd784"});
    }).mouseleave(function(){
    $(logoText).animate({ "left": "0" }, "600" ).css({"color": "#fff"});
    })



  • Recipe window event

    $(window).resize(function(){});
    

    Check of the width of the window

    if($(window).width() > 800){}
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2