Skip to main content
added 8 characters in body
Source Link
Alvaro
  • 2.6k
  • 2
  • 28
  • 29

In the Theme Customizer preview I am using Modernizr to include certain classes that change the page styles. If I understand it correctly, changing the device type to tablet or mobile only changes the window size but doesn't trigger any callback or page reload.

Right now, the only way I can think of is adding a resize listener in my preview script and see which device do the new window dimensions match.

I would like to know if there is a built-in filter or way to trigger a callback in the preview window so I can include the correct class for each device view.

In the Theme Customizer I am using Modernizr to include certain classes that change the page styles. If I understand it correctly, changing the device type to tablet or mobile only changes the window size but doesn't trigger any callback or page reload.

Right now, the only way I can think of is adding a resize listener in my preview script and see which device do the new window dimensions match.

I would like to know if there is a built-in filter or way to trigger a callback in the preview window so I can include the correct class for each device view.

In the Theme Customizer preview I am using Modernizr to include certain classes that change the page styles. If I understand it correctly, changing the device type to tablet or mobile only changes the window size but doesn't trigger any callback or page reload.

Right now, the only way I can think of is adding a resize listener in my preview script and see which device do the new window dimensions match.

I would like to know if there is a built-in filter or way to trigger a callback in the preview window so I can include the correct class for each device view.

Source Link
Alvaro
  • 2.6k
  • 2
  • 28
  • 29

Detect device change (desktop, tablet or mobile) in Customizer

In the Theme Customizer I am using Modernizr to include certain classes that change the page styles. If I understand it correctly, changing the device type to tablet or mobile only changes the window size but doesn't trigger any callback or page reload.

Right now, the only way I can think of is adding a resize listener in my preview script and see which device do the new window dimensions match.

I would like to know if there is a built-in filter or way to trigger a callback in the preview window so I can include the correct class for each device view.