JQuery should only function on desktop
I want a specific jQuery code to work only when the width is more than 1100px.
\n\nObviously, you can mix the ways...\nAdvantages of using media-query and css to do all that possible without JS is to prevent the ( rare ) case of browsers without JS or with but disabled by user ;)","upvoteCount":7},"suggestedAnswer":[{"@type":"Answer","text":"You should get screen with $(window) and use .width() function to get size\n\nif ($(window).width() > 1100) { \n//do something \n}","upvoteCount":6},{"@type":"Answer","text":"What happen if user want to access your code via Smartphone?\ni mean you must have a plan for Smartphone user, right?","upvoteCount":5},{"@type":"Answer","text":"the answer is in your question","upvoteCount":3},{"@type":"Answer","text":"yea but I need the code. I'm doing this if ( windowWidth > 1100px) {} . and it's not working","upvoteCount":2},{"@type":"Answer","text":"#Agus I have a animated header that shrinks down as you scroll but I don't want that for mobile.","upvoteCount":1}]} }
I want a specific jQuery code to work only when the width is more than 1100px.