刷新div(导致浏览重绘) [英] Refreshing div (cause browse to redraw it)
问题描述
在Web应用程序中,我遇到了动态内容的一些问题 - 通过隐藏或显示在jquery ui tab控件上方的表单会导致呈现问题,直到用户将鼠标悬停在选项卡上,然后导致选项卡标题重新绘制在正确的位置。
In a web application I'm hitting some troubles with dynamic content - where by a form being hidden or shown above a jquery ui tab control causes rendering issues until the user hovers there mouse over the tabs, which then causes the tab header to redraw in the correct location.
它只出现在IE7中,作为一个快速黑客,我在显示表单后执行此操作,导致选项卡的div被刷新IE:
It's only occuring in IE7 and as a quick hack I'm doing this after showing the form to cause the tab's div to be refreshed in IE:
$('#tabs')。css('display','none')。css('display','block ');
我只是想知道是否有更合适/可靠的方法来使div元素重绘/重新计算页面上元素的布局,因为我担心我的方法可能会对其他浏览器产生不必要的副作用。
I'm just wondering if there is a more appropriate/robust way to cause a div element to redraw itself / recalculate the layout of elements on a page, as I'm worried my approach may have unwanted side-effects on other browsers.
推荐答案
我有一个与此类似的问题,结果证明宽度未在显示div上设置。当我在它工作的元素上设置静态px宽度时。
I had a similar issue to this once, it turned out to be an issue with the width not being set on the displaying div. When I set the static px width on the element it worked.
这篇关于刷新div(导致浏览重绘)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!