Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Simulating Media Queries in a JS file Reply To: Simulating Media Queries in a JS file

#158723
CrocoDillon
Participant

I don’t know about Enquire. I know Modernizr has a MQ function which you could use.

Just wanted to say don’t do $(window) inside the event listener. That creates a new jQuery object every time and like you said it gets called a lot. Instead cache that object somewhere like var $window = $(window) and use $window every time you need it.