• Resolved Serge Gusev

    (@serge-gusev)


    Good day.

    During a page editing, it is possible to change the current preview mode – Desktop, Tablet or Model.

    Is there way to catch the preview mode changing event? I need it to rearrange some controls using JavaScript, but there is not window.resize event because the window has the same size for all preview modes.

    Thank you in advance,
    Serge

    • This topic was modified 2 years, 8 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • I think you’ll have to use the general method of resizing the browser window to get the window.resize event.

    Thread Starter Serge Gusev

    (@serge-gusev)

    Thank you, Vijay, but it does not work. For window.resize event @media works fine. I could solve the problem using @container, but it is in experimental mode yet.

    My current solution is:

    1. I have registered admin JS file
    2. It handles Preview button click and then Desktop/Tablet/Mobile buttons.

    Seems to be too complicated – I hoped there is a WP’s standard solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress preview change event’ is closed to new replies.