简体   繁体   English

调整大小时出现渲染问题

[英]rendering issue when resizing

I'm using bootstrap 3.3.7 and I use the standard bootstrap classes to create a menu. 我正在使用bootstrap 3.3.7,并使用标准的bootstrap类创建菜单。 I've restyled it so that the color is set to white with a purple backcolor. 我已经对其进行了重新样式设置,以便将颜色设置为带有紫色底色的白色。 All is fine when the page is initially loaded. 最初加载页面时,一切都很好。 As I reduce the screen width with the mouse, my menu starts to collapse down as expected, but the menuappears to disappear. 当我用鼠标减小屏幕宽度时,菜单开始按预期折叠,但菜单似乎消失了。 If I stop reducing the screen size and I then move my mouse over where the menu should be at that point it comes back into view. 如果我停止减小屏幕尺寸,然后将鼠标移至菜单应位于的位置,则它将重新显示。 So the action is working, the menu isn't keeping it's color scheme whilst being moved. 因此,该操作有效,菜单在移动时未保持其配色方案。 Have a missed a trick somewhere? 在某个地方错过了花样吗?

I get the same issue if I size my screen to e 767 such that my 'hamburger' button appears for the menu. 如果将屏幕尺寸调整为e 767,使菜单上出现“汉堡”按钮,则会出现相同的问题。 I click the hamburger and nothing seems to display until I move my mouse over the left of the screen where the menu is. 我单击了汉堡包,直到将鼠标移到菜单左侧的屏幕左侧,似乎什么也没有显示。

When you resize you viewport size with your mouse, the end result is not always correctly shown because of the javaScript working on that resize. 当您用鼠标调整视口大小时,由于javaScript在该调整大小上起作用,因此最终结果不会总是正确显示。

Try to use only the specific window sizes given: Ipad Pro, Ipad, etc. After selecting use a CTRL + F5 or CTRL + SHIFT + R for a hard refresh, and afterwards tell me if the problem persists. 尝试仅使用给定的特定窗口大小:Ipad Pro,Ipad等。选择后,使用CTRL + F5或CTRL + SHIFT + R进行硬刷新,然后告诉我问题是否仍然存在。

Also, check the built-in styles from bootstrap, it may change when you are on a tablet or mobile device. 另外,请从引导程序检查内置样式,当您在平板电脑或移动设备上使用时,它可能会更改。

codepen.io/bilpor/pen/gjRQgj codepen.io/bilpor/pen/gjRQgj

So after seeing the codepen, this is the desktop result. 因此,在查看代码笔后,这就是桌面结果。 在此处输入图片说明 This is the menu before I hover over it. 这是我将鼠标悬停在其上之前的菜单。

在此处输入图片说明

And this is the image after I hover over elements. 这是我将鼠标悬停在元素上之后的图像。

Regarding your issue, use you javascript code to run only on desktop. 关于您的问题,请使用JavaScript代码仅在桌面上运行。

  $(document).ready(function () { if (screen.width < 1024) { // your code that affect navbar here } else { alert(Error!); } }); 

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

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