admin管理员组

文章数量:1319015

In a web application, I'm hitting some troubles with dynamic content - whereby 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.

It's only occurring 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');

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.

In a web application, I'm hitting some troubles with dynamic content - whereby 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.

It's only occurring 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');

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.

Share Improve this question edited Sep 26, 2020 at 20:15 Alex 1,5801 gold badge15 silver badges27 bronze badges asked Mar 24, 2009 at 1:26 BittercoderBittercoder 12.1k10 gold badges60 silver badges77 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Wild guess, but could be hasLayout.

Try adding something like:

#tabs {
  zoom: 1;
}

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.

本文标签: javascriptRefreshing div (cause browse to redraw it)Stack Overflow