I am writing a responsive WordPress theme and am in a situation where I want to hide a div based on the screen resolution of the viewer.
I have a 468px by 60px advertising banner from BuySellAds in a div and I would like to hide it from viewers that view the site on a smartphone or tablet.
I tried to achieve this using CSS3 media queries however it did not work.
Can this be achieved using jQuery? If so any code to point me in the right direction would be greatly appreciated.
Thanks
You can take values from
$(window)selector. For getting current value; useresize()method:Here is working jsFiddle.
Edit: You can do this with pure css3 also, using this css:
And i suggest to inspect these answer’s, if you want to go further with jQuery scroll values: Setting CSS value limits of the window scrolling animation and How to build simple sticky navigation at the page bottum?