简体   繁体   English

select 元素的下拉菜单正在更改页面的背景(JS,MUI)

[英]Dropdown menu of a select element is changing the background of the page (JS, MUI)

I have kind of a weird problem in my website, but which seems to be a problem of the UI library I'm using.我的网站有一个奇怪的问题,但这似乎是我正在使用的 UI 库的问题。 Every time I click a select element in my page the background is slightly changing, in width, which flickers the background image.每次我单击页面中的 select 元素时,背景的宽度都会略有变化,这会使背景图像闪烁。 At first I though this is a problem in my code, but after checking, I see that in the UI library docs it also happens.起初我虽然这是我的代码中的一个问题,但在检查之后,我发现在 UI 库文档中它也发生了。

Example:例子:

  1. My site: https://dinsangun.github.io/crypto-converter/我的网站: https://dinsangun.github.io/crypto-converter/
  2. The lib docs: https://mui.com/components/selects/ (In the lib docs, when you click a select element, pay attention to the slider on the right side, it disappears when the dropdown menu of the select items is clicked) The lib docs: https://mui.com/components/selects/ (In the lib docs, when you click a select element, pay attention to the slider on the right side, it disappears when the dropdown menu of the select items is点击)

Is there a way to overcome this little bug?有没有办法克服这个小错误?

Thanks.谢谢。

Your problem comes from the scrollbar, when you click on the select it dissapears and so the background extends to cover all the screen.您的问题来自滚动条,当您单击 select 时,它会消失,因此背景会延伸到整个屏幕。 It's the same problem for MUI website. MUI网站也是同样的问题。 One of the solution I can propose would be to put on your body or root div height:100vh;overflow:hidden;我可以提出的解决方案之一是放在你的bodyroot div height:100vh;overflow:hidden;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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