I have an AJAX page with a CSS menu at the top. My problem is the hover functionality stops working after someone clicks on one of the details in the main blue section. This only occurs in IE6. IE7 and FF work correctly.
The URL to the page is:
http://www.coralap.com/dies281css.aspx
Steps to reproduce:
1. Mouse over the top menu and verify the hover works.
2. Click on the circle with the number "1" in it.
3. Mouse over the top menu again. The items no longer light up and the "Products" flyout no longer appears.
I use a JavaScript routine to add an event handler for IE6, so that hover works. A also use VB code-behind for the download functionality.
I will post the CSS, VB code, HTML and the JavaScript below.
The code in "capcss.css" is:
Expand|Select|Wrap|Line Numbers
- body
- { background-image:url(images/capback.jpg);}
- #caplogo
- { margin:32px 0px 10px 10px;}
- /*Middle Graphic********************************/
- #leftside
- { float:left;}
- #leftsideimage
- {
- float:left;
- width:17px;
- height:175px;
- margin:0px;
- background-image:url(images/leftside.jpg);
- }
- #rightside
- {
- float:left;
- width:793px;
- height:175px;
- background-image:url(images/rightside.jpg);
- margin-right:-5px; /*IE6 Hack. IE adds pixels to the right margin of the last item floated to the left*/
- }
- .fullpagewidth
- { width:979px;}
- /*Menu on front page**************/
- #menu{ width:169px; float:left;}
- #capmenu,
- #capmenu ul
- {
- float:left;
- padding:0 0 0 0;
- margin:0;
- list-style:none;
- background-image:url(images/leftmenuback.jpg);
- position:relative;
- z-index:200;
- width:169px;
- height:175px;
- /*font: 16px verdana, sans-serif; */
- font-family:Arial;
- font-size:10pt;
- font-weight:bold;
- }
- #capmenu li li
- { background-image:url(images/leftmenuback.jpg);}
- /* a hack for IE5.x and IE6 */
- * html #capmenu li
- { float:left;}
- #capmenu li a /*text for menu links on left-hand side. original*/
- {
- height:25px;
- padding:0 0 0 5px;
- color:rgb(0, 0, 0);
- text-decoration:none;
- white-space:nowrap;
- display:block;
- width:169px;
- }
- #capmenu li:hover
- { position:relative; z-index:300; background:url(images/menulit.jpg);}
- #capmenu ul
- { position:absolute; left:-9999px; top:-9999px;}
- /*hack for IE6 */
- * html #capmenu, * html capmenu ul
- { width:1px;}
- /*flyout pop-up*/
- #capmenu li:hover > ul
- {
- left:-15px;
- top:-1px;
- margin-left:100%;
- width:229px;
- height:100px;
- }
Expand|Select|Wrap|Line Numbers
- /*hide sub menu*/
- #capmenu li:hover > ul ul
- { position:absolute; left:-9999px; top:-9999px; width:auto;}
- /* show path followed */
- #capmenu li:hover > a
- { text-decoration:none; color: rgb(250, 250, 250);}
- /*IE6 Hack flyout pop-up*/
- #capmenu li:hover ul
- {
- left:-15px;
- top:-1px;
- margin-left:100%;
- width:229px;
- height:100px;
- }
- /*IE6 Hide sub menu*/
- #capmenu li:hover ul ul
- { position:absolute; left:-9999px; top:-9999px;}
- /*IE6 show path followed */
- #capmenu li:hover a,
- #capmenu li:hover li:hover a
- { text-decoration:none; color: rgb(250, 250, 250);}
- /*IE6 hide futher possible paths */
- #capmenu li:hover li a
- {
- text-decoration:none;
- color:#000;
- width:229px; /*IE6 Hack to make lit background full menu width, and not just the width of the text*/
- }
- /******************************************************************************************/
Expand|Select|Wrap|Line Numbers
- #capcontainer
- {
- float:left;
- width:991px;
- height:540px;
- position:absolute;
- left:0px;
- top:0px;
- }
- #capleft
- {
- float:left;
- width:814px;
- margin-right:-3px;
- height:530px;
- }
- #topcontainer
- { float:left; width:611px;}
- #topdiecontainer
- { float:left; width:775px}
- #pagetitle
- { width:611px; height:56px; float:left;}
- #topofpagetext
- { width:600px; float:right; padding-right:5px;}
- .tabletext
- {
- margin-bottom:5px;
- border-bottom:solid thin black;
- width:600px;
- float:left;
- font-family:Arial;
- font-size:smaller;
- font-weight:bold;
- }
- .rightmenu
- {
- background-image:url(images/ppage/rightpanelcss.jpg);
- background-repeat:no-repeat;
- width:180px;
- height:530px;
- padding-top:4px;
- float:right;
- }
- .rightul
- {
- float:left;
- list-style-type:none;
- padding:0;
- margin:14px 0px 0px 4px;
- }
- .rightli
- { width:168px; background-color:rgb(204,204,204); padding:0px 0px 0px 5px;}
- * html .rightul /*IE6 Hack*/
- { width:173px; margin-left:2px;}
- /*Header text for entrances.aspx*/
- #htsystem
- { float:left; margin:0px 38px 0px 25px;}
- #htstyle
- { float:left; margin:0px 28px 0px 20px;}
- .htrailbottom
- { float:left; margin:0px 28px 0px 5px;}
- #httraffic
- { float:left; margin:0px 5px 0px 5px;}
- #htnarrow
- { float:left; margin:0px 10px 0px 5px;}
- #htlinetwo
- { float:left; margin:0px 33px 0px 5px;}
- #htlinethree
- { float:left; margin:0px 23px 0px 5px;}
- #htlinefour
- { float:left; margin:0px 28px 0px 5px;}
- .htlinefivesix
- { float:left; margin:0px 23px 0px 20px;}
- /*Top Menu*******************************************/
- #topmenu,
- #topmenu ul
- {
- padding:0;
- margin:0;
- list-style:none;
- font: 10px verdana, sans-serif;
- background-image:url(images/menu/topmenuback.jpg);
- border:0;
- position:relative;
- z-index:200;
- }
- #topmenu
- { height:20px; padding:0;}
- #topmenu li
- { float:left;}
- #topmenu li li
- { float:none; background:#ccc;}
Expand|Select|Wrap|Line Numbers
- /*hack for IE6 */
- * html #topmenu li li
- { float:left;}
- #topmenu li a
- {
- display:block;
- float:left;
- color:#000;
- height:20px;
- line-height:15px;
- text-decoration:none;
- white-space:nowrap;
- font-weight:bold;
- }
- #topmenu li li a
- { height:20px; line-height:20px; float:none;}
- #topmenu li:hover
- { position:relative; z-index:300;}
- #topmenu li:hover ul
- {
- left:0;
- top:18px;
- height:80px;
- background:#ccc;
- border-bottom:solid thin white;
- border-right:solid thin white;
- border-left:solid thin white;
- width:140px;
- }
- /*hack for IE6 */
- * html #topmenu li:hover ul
- { left:0px;}
- #topmenu ul
- { position:absolute; left:-9999px; top:-9999px;}
- /*hack for IE6 */
- * html #topmenu ul
- { width:1px;}
- /* show next level */
- #topmenu li:hover li:hover > ul
- { left:-15px; margin-left:100%; top:-1px;}
- /* keep further levels hidden */
- #topmenu li:hover > ul ul
- {
- position:absolute;
- left:-9999px;
- top:-9999px;
- width:auto;
- }
- /* show path followed */
- #topmenu li:hover > a
- { text-decoration:none; color:#fff;}
- /*flyout dropdown */
- #topmenu li:hover li:hover ul
- { left:-15px; margin-left:100%; top:-1px;}
- /*hide sub menu*/
- #topmenu li:hover ul ul
- { position:absolute; left:-9999px; top:-9999px;}
- /* show path followed */
- #topmenu li:hover a,
- #topmenu li:hover li:hover a
- { text-decoration:none; color:#fff;}
- /* hide futher possible paths */
- #topmenu li:hover li a,
- #topmenu li:hover li:hover li a
- { text-decoration:none; color:#000;}
- /*die pages****************************************************************/
Expand|Select|Wrap|Line Numbers
- #diepagecontainer
- { width:979px; height:552px;}
- #dienodecontainer
- { height:357px; width:618px; float:left;}
- #dieulcontainer
- {
- list-style:none;
- width:618px;
- height:357px;
- margin:0;
- padding:0;
- }
- .licontainer
- { float:left; width:618px;}
- #dierightpanelcontainer
- {
- width:157px;
- height:357px;
- float:left;
- background-image:url(images/filepanel/rightfilepane.gif);
- }
- #diebottomcontainer
- { width:778px; float:left;}
- /*CAPDOwnload page**********************************************************/
- #downloadcontainer
- { width:814px;}
- #downloadleft
- {
- float:left;
- width:814px;
- position:absolute;
- left:0;
- top:0;
- margin-right:-3px;
- }
- #downloadcustsvc
- {
- margin-left:201px;
- height:220px;
- margin-top:21px;
- width:601px;
- padding:0px 0px 0px 10px;
- }
- #downloadtitlecustsvc
- { width:611px; margin-top:10px; margin-bottom:10px;}
- #downloadcustsvcleft
- { float:left; width:218px;}
- #downloadcustsvcright
- { float:right; width:238px;}
- #downloadtitlecredit
- {
- width:601px;
- margin-left:201px;
- margin-top:10px;
- margin-bottom:10px;
- }
- #downloadcredit
- {
- width:601px;
- margin-left:201px;
- height:120px;
- padding:0px 0px 0px 10px;
- }
- #downloadcreditleft
- { float:left; width:218px;}
- #downloadtitleliterature
- {
- width:611px;
- margin-left:201px;
- margin-top:10px;
- margin-bottom:10px;
- }
- #downloadliterature
- {
- width:611px;
- height:40px;
- margin-left:201px;
- padding:0px 0px 0px 10px;
- }
- #downloadliteratureleft
- { float:left; width:218px;}
- #downloadliteratureright
- { float:right; width:238px;}
- a.download{font-family:Arial; font-size:x-small;}
- a.download:link {color: black; text-decoration: none;}
- a.download:visited {color: black; text-decoration: none;}
- a.download:background-color {color:white; text-decoration: none;}
- a.download:hover {color: black; text-decoration: none; background-color: #aaaaaa;}
- a.title{ font-family:Arial Black; font-size:small;}
- /****companyinfo.aspx************************************************************/
- #companyinfotitle
- {
- display:block;
- width:600px;
- margin-left:201px;
- margin-top:40px;
- height:20px;
- padding:0px 0px 0px 10px;
- }
- #companyinfocontainer
- { width:600px; float:right; padding-top:10px;}
- p.text{ font-family:Arial; font-size:small; font-weight:bold;}
- /******gallery.aspx**************************************************************/
- p.gallery
- { font-family:Arial; font-size:larger; font-weight:bold; text-align:center; margin-top:30%;}
- #gallerycontainer
- { width:600px; height:530px; margin:21px 0px 0px 201px;}
The code in "tophover.js" is:
Expand|Select|Wrap|Line Numbers
- Hover = function() {
- var cssRule;
- var newSelector;
- for (var i = 0; i < document.styleSheets.length; i++)
- for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
- {
- cssRule = document.styleSheets[i].rules[x];
- if (cssRule.selectorText.indexOf("LI:hover") != -1)
- {
- newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
- document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
- }
- }
- var getElm = document.getElementById("topmenu").getElementsByTagName("LI");
- for (var i=0; i<getElm.length; i++) {
- getElm[i].onmouseover=function() {
- this.className+=" iehover";
- }
- getElm[i].onmouseout=function() {
- this.className=this.className.replace(new RegExp(" iehover\\b"), "");
- }
- }
- }
- if (window.attachEvent) window.attachEvent("onload", Hover);
HTML code is posted in the 2nd post. VERY sorry for this.