Explanation wanted of how script is called

R

Randy Webb

Richard said:
http://www.htmldog.com/articles/suckerfish/dropdowns/example/bones2.html

#nav li:hover ul ul, #nav li.sfhover ul ul {
left: -999em;
}

I am assuming that the class is created by the scripting?
What if the visitor has JS turned off?
What happens when this created class is not found?

What I don't understand is, even with JS turned off, the menu works just
fine, so why have the script?

Tested in both IE and FF.

Because its a CSS menu, not a Javascript menu.
 
R

Richard

Because its a CSS menu, not a Javascript menu.

Duhhh nah really?
All I want to know is what's the purpose of the script to begin with?
As far as I can tell, it's not even being called to do work.
 
R

Randy Webb

Richard said:
Duhhh nah really?
All I want to know is what's the purpose of the script to begin with?

If you can't read the page and understand it, then you sure won't
understand it if I can explain it.
As far as I can tell, it's not even being called to do work.

And that is why you are the one thats asking about it and not me. RTFM.
Because in certain scenarios, it *does* get called to do work. But if
you understood enough about scripting to know what
if(window.attachEvent) meant, you would understand when, and why, it is
called.
 
R

Richard

5 minutes with google will show you a lot:

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/attachev
ent.asp
attachEvent Method
Binds the specified function to an event, so that the function
gets called whenever the event fires on the object.
http://www.quirksmode.org/js/events_advanced.html
http://www.quirksmode.org/js/this.html
http://www.quirksmode.org/
Javascript >> Events > Introduction to Events
http://www.htmldog.com/articles/suckerfish/dropdowns/
...And that will sort out everything for those browsers that fully
support the :hover pseudo class, but for Internet Explorer we
need to set the Suckerfish JavaScript loose:
sfHover = function() {...
http://www.htmldog.com/articles/suckerfish/
The Suckerfish...
Right. So, basically, in browsers such as Mozilla, Opera and Safari
you can use :hover, :active and :focus to achieve the effects that
the CSS standards intend. The trouble is that when it comes to
anything other than links, Internet Explorer ignores these
pseudo-classes (and it doesn't like :focus at all). To get around
this we can use JavaScript similar to the following:
sfHover = function() {...

Mike


Thank you. That's what I wanted to know.
I wasn't sure what was triggering the script.
 
R

Richard

If you can't read the page and understand it, then you sure won't
understand it if I can explain it.


And that is why you are the one thats asking about it and not me. RTFM.
Because in certain scenarios, it *does* get called to do work. But if
you understood enough about scripting to know what
if(window.attachEvent) meant, you would understand when, and why, it is
called.

You just have to be a smart ass don't you?
You could just say, "The function is triggered by the movement of the mouse
over the specified area.".
 
R

Randy Webb

Richard said:
You just have to be a smart ass don't you?

Only to dumbasses who repeatedly ask questions without doing a little
research first.
You could just say, "The function is triggered by the movement of the mouse
over the specified area.".

And give incorrect/incomplete answers like you do? No thanks.

That is not the only part of that script, and hence my reply. The
function is triggered if, and only if, three things happen:

1) The UA supports window.attachEvent
2) The UA successfully attaches an even to the window
3) The movement of the mouse over the window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top