Document and window #1222
-
| I have created a css grid where users can enter the number of rows and columns. I want to be able, when the width of the window is smaller than the height, to swap the number of rows and columns around. I can’t seem to find a way to access the window element, so I’ve created a custom event handler that sends the window.innerHeight and width under detail. I receive the event but the detail information doesn’t seem to be there. Any help would be appreciated | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
| If you need direct access to the client-side DOM, I would recommend switching to  Then, you'd be able to query the DOM within a  import js
@use_effect
async def peroidic_polling():
    while True:
        if js.window.innerWidth < 1200:
            ...
        await asyncio.sleep(0.5)I am working on migrating pyscript components to core, but a few other things are currently taking priority. | 
Beta Was this translation helpful? Give feedback.
If you need direct access to the client-side DOM, I would recommend switching to
reactpy-djangoand usepyscript_component.Then, you'd be able to query the DOM within a
use_effecthook with pyscipt's JS module.I am working on migrating pyscript components to core, but a few other things are currently taking priority.