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:
    http://www.rafflesnagoya.com/test/hover.html

    There's a nice introduction to the method here:
    http://www.communitymx.com/content/article.cfm?cid=52428

    and two articles by Peter N here:
    http://www.xs4all.nl/~peterned/csshover.html
    http://www.xs4all.nl/~peterned/hovercraft.html

    (conditional comments:
    http://www.quirksmode.org/css/condcom.html)

    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?

    PS
    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:
    http://dean.edwards.name/IE7/overview/
    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 csshover.htc 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
    www.rafflesnagoya.com/test/hover.html
    and check that the hover effects are working OK.

    (Xp SP2 only accepts the csshover.htc 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 www.rafflesnagoya.com/csshover.htc is being given by the server?

    Thanks a lot,
    John
  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.

    John

Share This Page