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