eciusr
eciusr

Reputation: 163

how to deactivate jquery according to the viewport size

I have a navigation menu that slides out onto the webpage using .animate(). It looks great until the the browser size gets below 1000px. is there a way to tell jquery to not use the function I created if the viewport is smaller than 1000px, so I can let css take over?

Upvotes: 0

Views: 103

Answers (2)

JimMorrison723
JimMorrison723

Reputation: 113

I dont't know if there is a nice and small solution for that, but you can check the window width if it is bigger then 1000px and than load the script.

if($(window).width() > 1000) {
    $.getScript // http://api.jquery.com/jQuery.getScript/
}

Upvotes: 1

Philippe Boissonneault
Philippe Boissonneault

Reputation: 3949

I don't think you can desactivate jQuery in CSS, but before you animate you can do that :

if($(window).width() > 1000) {
    //animate
}

Upvotes: 1

Related Questions