# MediaQueryObserver.observe(Object descriptor, function callback)
with Promise style call: Not supported
Mini Program plugin: Support
Start listening to page media query Changes
# parameter
# Object descriptor
media query Descriptor
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
minWidth | number | yes | Minimum page width px In units) | |
maxWidth | number | yes | Maximum Page Width ( px In units) | |
width | number | yes | Page width px In units) | |
minHeight | number | yes | Minimum page height px In units) | |
maxHeight | number | yes | Maximum Page Height ( px In units) | |
height | number | yes | Page height ( px In units) | |
orientation | string | yes | Screen direction ( landscape or portrait ) |
# function callback
to monitor media query State change callback function
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
matches | boolean | Does the current state of the page satisfy the specified media query |
The translations are provided by WeChat Translation and are for reference only. In case of any inconsistency and discrepancy between the Chinese version and the English version, the Chinese version shall prevail.Incorrect translation. Tap to report.