Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
JS Menus - Small Issue with IE
Old 03-15-2005, 02:06 AM JS Menus - Small Issue with IE
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Check there for a preview of my nights work

Anyway, if you check it out in Moz, it works fine. But check it out in IE and hover your mouse over the topnav text (which are links), then when the menu comes up, move your mouse down as if you were going to hover over one of the items. You'll see that the menu will disappear. But if you put your mouse over to the side of the text and do the same, the menu remains (as it supposed to).

If I take out the anchors (meaning, leave only the text), it works fine. IE just hates those anchors for some reason lol.

Anyway, some files you might want to look at if you're willing to help
  • global.js - Just some generic functions
  • menu.js - The meat and potatoes of the menu functionality
  • main.css - The CSS file. Don't think it has anything to do with the CSS though.

The only thing that closes any menus is the closeMenu function which is called on document.onmouseover. The anchors are part of an object which stops event bubbling, so in theory, they shouldn't be closing lol.

And yes, the anchors do matter. DHTML is just a feature to me, the page still has to function without it.

Edit: Took the files off from my server. I've attached them to this post for people who read this later.
Attached Files
File Type: zip js_menu.zip (20.4 KB, 13 views)
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-15-2005, 04:14 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
I've made a satisfactory fix. Created a browser sniffer to sniff out IE's (not sure if the bug exists in other browsers, have to check it out), then did some IE-only stuff to kill the anchors within init_menu().

Code:
    //-----------------
    // Fix IE thing with
    // anchors
    //-----------------
    if(is_ie)
    {
        a_tags = obj_fire.getElementsByTagName("a");

        if(a_tags)
        {
            content = "";
            for(var i = 0; i < a_tags.length; i++)
            {
                content += a_tags[i].innerHTML;
                a_tags[i].removeNode(false);
            }

            obj_fire.innerHTML = content;
        }
    }
It's not only anchors, I believe it's any inline element. This'll work for now, but I'm still searching for a real solution

// Edit
Okay, I've made another more reasonable solution. I just cancel the closing of menus if the menu was opened via onmouseover of a inner item of the menu div. Still don't know why it's doing that, I stop bubbling and proagation with the handleEvent function.

Anyway, here it is.
Code:
/*------------------------------------------------------------------------*\
  init_menu
      - Initiate a menu
\*------------------------------------------------------------------------*/
function init_menu(id_fire, noarrow)
{
    obj_fire = getObj(id_fire);

    if(!obj_fire)
        return;

    if(!noarrow)
        document.write('<img src="' + IMG_DIR + '/menu_arrow.gif" alt="" border="" />');


    //-----------------
    // Fix for menu
    // closing
    //-----------------
    if(obj_fire.children)
    {
        for(var i = 0; i < obj_fire.children.length; i++)
        {
            obj_fire.children[i].onmouseover = function() { fire_cancelclose = true; } ;
        }
    }

    //-----------------
    // Enable onmouseover
    // on fire
    //-----------------
    obj_fire.onmouseover = menufire_onmouseover;
}

/*------------------------------------------------------------------------*\
  document_onmouseover
      - Handle the closing of the menus when they leave the menu area
\*------------------------------------------------------------------------*/
function document_onmouseover()
{
    if(fire_cancelclose)
    {
        fire_cancelclose = false;
        return true;
    }

    closeMenu();
    return true;
}
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 03-16-2005, 05:36 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Can you not make the anchors block level?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 03-16-2005, 09:07 AM
Average Talker

Posts: 15
Trades: 0
Quote:
Originally Posted by 0beron
Can you not make the anchors block level?
Just wanted to ask the same question.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
bunker is offline
Reply With Quote
View Public Profile
 
Old 03-16-2005, 11:37 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
It's a shot in the dark - Chroder will probably post back and give us a really good reason why not!
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 03-16-2005, 01:26 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
I tried Only thing that worked is to 'cancel' any closing of the menus when the mouse strays over any child element within the div.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to JS Menus - Small Issue with IE
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.70096 seconds with 13 queries