Last post Apr 13, 2007 10:43 AM by Russ Helfand
Mar 27, 2007 05:12 AM|LordNemesis|LINK
I've recently implemented CSS friendly control adapters by using PrettyMenu. At first everything seemed ok, but I discovered that in IE6 the menu is flickering (all other browsers are showing it correctly). After a bit google-ing I found that the flicker problem
is caused by background image caching.
The fix for this problem is discribed here:
http://www.groovybits.com/leftOverBits/flickerFix.aspx. I copied the PersistantImage.ashx from this link to the root of my website.
I tried the fix, and was confident that it would work. But it doesn't. The menu is not flickering anymore, but the background image is not showing instead.
Here's the code:
Mar 27, 2007 04:41 PM|Russ Helfand|LINK
The example that I posted at
http://www.groovybits.com/leftOverBits/flickerFix.aspx presumed that you put your style sheets in a folder that was DIRECTLY beneath the root of your site. In that situation, the double-dots in the url for the background image brings you up one level to
the root folder. If, however, you are working with a style sheet that is in an ASP.NET theme folder then you are in a situation where the style sheet is TWO levels below the root. In that case, the proper path would be:
Notice that this has two doulbe-dot sets to bring you up TWO levels. That would bring you to the root if this were used in a style sheet in a theme folder.
Does that help?
Mar 28, 2007 03:57 AM|LordNemesis|LINK
I can't believe I lost almost a days work on that one. [:|]
The extra ../ (I thought that it was a typo...) did the trick.
Thank you Russ!
Apr 12, 2007 07:24 AM|kallileo|LINK
Apr 12, 2007 09:44 AM|Russ Helfand|LINK
Because your image is in the Images folder beneath the root, it is correct to set the value of the key (in the web.config) as you proposed to "~/Images/bg_nav.gif". That part is fine but is completely independent of where you happen to put the handler (ASHX
file). If, as you proposed, you put the handler in the root folder then the path to it from a CSS file in a subfolder of the root is, as your sample shows, ../PersistantImage.ashx. However, if your CSS file is in a SUBsubfolder (that is, two folders down in
the hierarchy from the root) then the url for the background should refer to ../../PersistantImage.ashx in order to ascend two levels to reach the place where the handler is kept.
Remember, when you are stipulating the background's url to be the handler you have to provide a path to the PeristantImage. You can do so with a site-relative path (one that starts with a forward slash) or you can use a relative path. If you use a relative
path then you have to remember that it is relative to where the CSS file lives. So you need to ascend as many levels up and then descend (if necessary) to wherever the handler lives.
You might also consider simply putting the handler in the same folder as your CSS file. Then you don't need a path in front of PersistantImage.ashx at all!!!
Good luck. Let me know if the flicker fix makes a difference for you.
Apr 13, 2007 03:26 AM|kallileo|LINK
Apr 13, 2007 10:43 AM|Russ Helfand|LINK
background: url(PersistantImage.ashx?key=BasicBgNav) repeat-x;
You are creating a key in your app settings so you can use it (rather than the file name) when you invoke the handler.