Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.addEventListener('DOMContentLoaded', function(){
- var mobile = window.matchMedia( 'only screen and ( max-width: 640px )');
- applyMobileStyles()
- mobile.addListener( applyMobileStyles );
- function applyMobileStyles() {
- if ( mobile.matches ) {
- document.body.style.backgroundColor = 'grey';
- console.log('mobile');
- } else {
- document.body.style.backgroundColor = 'grey';
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement