Forum Moderators: open
My solution to this was a hack, basically. Whenever someone using your website clicks away from the tab or away from the browser and comes back to it, you detect that with javascript and then RE-draw the nifty corners divs. The hack is two-fold: first you search through the page and *hide* the divs containing the top and bottom rounded-ness. Then you re-invoke the Rounded() functions to put new tops and bottoms on top of all the nifty corners divs.
So, for step 1, you would do the following:
var v=getElementsBySelector("b.rtop");for(i=0;i<v.length;i++)
v[i].style.display = 'none';v = getElementsBySelector("b.rbottom");
for(i=0;i<v.length;i++)
v[i].style.display = 'none';
The "getElementsBySelector" function is a function that already
comes with nifty corners, so it should already be there in your .js file.
Basically, it's look for all of the new horizontal <b> elements that
are a part of the style classes "bottom" and "top" and hides them.
Of course a better solution would be to just delete the goddamn things,
but I'll leave that task to someone else to do.
Step 2: re-draw the tops and bottoms fresh:
For that, of course you would just call Rounded() again on all of
your divs that you are applying nifty corners on.
Step 3: Detecting WHEN to hide the divs in step 1
For this, you want to detect when the window goes out of focus and
then comes back into focus. So, you would put the code in step 1
into a function and then call it with the following code that
goes something like this:
function onFocus(){
// call function to hide old nifty divs
// call your code to re-draw the nifty divs
};//now tell IE to call that function when the window comes back into focus
//set this on body onload or something
window.onfocus = onFocus;
Hope that helps!
[edited by: tedster at 8:29 pm (utc) on Oct. 19, 2008]
So, I have found this solution:
<link rel="stylesheet" type="text/css" href="./script/niftyCorners.css">
<link rel="stylesheet" type="text/css" href="./script/niftyPrint.css" media="print">
<script type="text/javascript" src="./script/nifty.js"></script>
<script type="text/javascript">
var clockID_Nifty=0;
//Called on window onload event to draw the nifty corners the first time and to set the timeout after which the Nifty corners have to be redrawn to solve the IE problem:
function Nifty(){
Nifty_draw();
clockID_Nifty = setTimeout("Nifty_scheduled()", 1000);
}
function Nifty_scheduled(){
Nifty_Redraw();
clearTimeout(clockID_Nifty);
}
function Nifty_Redraw(){
var v=getElementsBySelector("b.rtop");
for(i=0;i<v.length;i++)
v[i].style.display = 'none';
v = getElementsBySelector("b.rbottom");
for(i=0;i<v.length;i++)
v[i].style.display = 'none';
Nifty();
};
//Draw Nifty Corners
function Nifty_draw(){
if(!NiftyCheck()) return;
//Customize the following lines to "round" your items!
Rounded(".rounded","#FFFFFF","#E5E2FF");
Rounded(".roundedLat","#E5E2FF","#DBDBDB");
Rounded(".roundedFoot","#FFFFFF","#BCB5FF");
}
</script>
<body onload="Nifty();">
And it works on IE6, IE7, FF2, FF3, Chrome on Windows XP, Vista and Windows 2000.