You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
471 B

  1. import enquireJs from 'enquire.js'
  2. const enquireScreen = function (call) {
  3. // tablet
  4. const handler = {
  5. match: function () {
  6. call && call(0)
  7. },
  8. unmatch: function () {
  9. call && call(-1)
  10. }
  11. }
  12. // mobile
  13. const handler2 = {
  14. match: () => {
  15. call && call(1)
  16. }
  17. }
  18. enquireJs.register('screen and (max-width: 1087.99px)', handler)
  19. enquireJs.register('screen and (max-width: 767.99px)', handler2)
  20. }
  21. export default enquireScreen