PreferenceManager: thuộc tính reducedMotion

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Thuộc tính chỉ đọc reducedMotion của giao diện PreferenceManager trả về PreferenceObject dùng để ghi đè tùy chọn của người dùng về chuyển động giảm của trang web.

Các cài đặt PreferenceObject.value hợp lệ cho reducedMotionreduceno-preference.

Giá trị

Một PreferenceObject dùng để ghi đè tùy chọn của người dùng về chuyển động giảm của trang web.

Ví dụ

Sử dụng cơ bản

Ví dụ này minh họa cách truy vấn tùy chọn chuyển động giảm của người dùng.

js
if (navigator.preferences.reducedMotion.value === "reduce") {
  // The user prefers reduced motion.
} else {
  // The user has stated no preference regarding motion.
}

Thông số kỹ thuật

Thông số kỹ thuật
Media Queries Level 5
# reduced-motion-attribute

Tương thích trình duyệt