admin管理员组

文章数量:1023118

I have a simple vue ponent 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 ponent 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.

I have a simple vue ponent 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 ponent 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.

Share Improve this question asked May 21, 2020 at 13:57 guggioguggio 2211 gold badge5 silver badges19 bronze badges 1
  • 1 To get the body just use document.body – VLAZ Commented May 21, 2020 at 13:59
Add a ment  | 

1 Answer 1

Reset to default 6

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

I have a simple vue ponent 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 ponent 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.

I have a simple vue ponent 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 ponent 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.

Share Improve this question asked May 21, 2020 at 13:57 guggioguggio 2211 gold badge5 silver badges19 bronze badges 1
  • 1 To get the body just use document.body – VLAZ Commented May 21, 2020 at 13:59
Add a ment  | 

1 Answer 1

Reset to default 6

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

本文标签: vuejsHow to select document body in JavascriptStack Overflow