Home › Forums › JavaScript › Simulating Media Queries in a JS file › Reply To: Simulating Media Queries in a JS file
December 19, 2013 at 4:18 am
#158723
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.