简体   繁体   中英

How to select document body in Javascript

I have a simple vue component that will display a preloader when some images are loaded or changes. It's working fine, but I'm not able to disable the overflow of the document body when the component is displayed. Is there a way in Javascript to select the body and set the overflow to hidden? I'm not expert in vanilla javascript.

You can use querySelector to select any item in your DOM. Here is the mdn_link for details

If you want to select the body then simply you can use document.body

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM