Instant ":hover" plugin for IE

Discussion in 'HTML Development' started by JohnC, Aug 9, 2005.

  1. JohnC < ? />

    (I think this is pretty neat so please bear with me if you've heard it all before...)

    I know there's a case for not pandering to Internet Explorer's peculiarities, so as to encourage people to move to better browsers:
    ("Firefox users have More Fun!", "Get a Browser!" etc)
    but it would be so nice to have the :hover pseudo-class working for anything:
    drop-down menus, pop-up windows, any time you want to pack in a lot of information without cluttering up the page. But IE only supports it for links :(

    But a Dutch guy called Peter Nederlof has written a bit of script which you can attach to the page in a way that only IE sees it, and all you have to do is write the css!

    I know as much javascript as a hole in the ground but could make a few :hover things happen to a <p> tag, and adapt a dropdown menu to my site:

    There's a nice introduction to the method here:

    and two articles by Peter N here:

    (conditional comments:

    Looks pretty good- still needs javascript to be enabled for IE users, but you don't have to write any, and your code stays nice and clean.

    One thing, with XP Service Pack 2, the OS will reject the .htc file (the script thing), unless the server serves that file with the
    MIME-type: text/x-component. (whatever that is...???)
    Can anyone confirm that HU's server will do that?

    You might think "why doesn't someone write something to fix all IE's css problems?".
    Well a guy called Dean Edwards has written IE7:
    So when you've had enough :hovering you might want a look...

    Meanwhile I'm off to play with some ways to make images appear and disappear :)
  2. JohnC < ? />

    htc mime type

    I found you can set new mime types in .htaccess, so have added something for .htc files as "text/x-component".
    Something seems to have changed as Firefox now won't open the file like a text file as before but asks me what to do with it.

    But I'm using windows 98 so it would help a lot if someone running IE on win Xp SP2 could have a look at
    and check that the hover effects are working OK.

    (Xp SP2 only accepts the file if it's got a proper mime type, but other windows systems allow it anyway.)

    Alternatively, anyone know how I can check what mime type is being given by the server?

    Thanks a lot,
  3. fidget Vox et praeterea nihil

  4. JohnC < ? />

    Many thanks Fidget- that's indeed what I wanted.
    Never thought of sending the file in for validation...

    Great! Now I can go ahead and make a new navigation menu, and some popup descriptions of dishes on our (food) menu, photos etc , knowing they should work for most of my visitors (Firefox, Opera, Safari etc + all IE users with Javascript enabled).
    The popups are probably dispensible for the noscript 20% of IE, so I just have to make sure the navigation will still work somehow.


Share This Page