Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import _debounce from 'lodash/debounce';
  2.  
  3. window.addEventListener('resize', _debounce(checkMediaQueries, 200), false);
  4. let viewport = document.querySelector("meta[name=viewport]");
  5.  
  6. function checkMediaQueries() {
  7. viewport.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0');
  8. if (window.matchMedia('screen and (max-width: 380px)').matches) {
  9. viewport.setAttribute('content', 'width=380');
  10. }
  11. }
  12. checkMediaQueries();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement