-
-
Notifications
You must be signed in to change notification settings - Fork 328
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.
All reactions
If you need direct access to the client-side DOM, I would recommend switching to reactpy-django and use pyscript_component.
Then, you'd be able to query the DOM within a use_effect hook with pyscipt's JS module.
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.
Replies: 1 comment
-
If you need direct access to the client-side DOM, I would recommend switching to reactpy-django and use pyscript_component.
Then, you'd be able to query the DOM within a use_effect hook with pyscipt's JS module.
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.