最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

vue.js - How to select document body in Javascript - Stack Overflow

matteradmin5PV0评论

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

Post a comment

comment list (0)

  1. No comments so far