SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Whatever:hover has stopped working

    Hi,

    Not sure what's going on, as just recently it was working fine on our site, but suddenly Whatever:hover has completely stopped working in both IE6 and IE7.

    I simply have a link to the file in the body of my CSS like so:

    Code CSS:
    behavior:url('../../csshover2.htc');

    I have also tried with a relative path, and also with a relative path, but still no joy.

    Example usage:
    Code CSS:
    input:focus, textarea:focus{
    	background-color: lightyellow;
    }
    #livesearch li:hover, #additionallive li:hover {background: #eee; color: #900}
    Neither work at all in IE, but Firefox is fine. The focus above works great, the hover attribute is new but hover has worked fine in the past.

    Have I set everything up correctly? I've tried deleting other javascript/css as a test and it's still not working :/

  2. #2
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Just tried creating a test page, still no luck:

    Code HTML4Strict:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    	<style type="text/css">
    	body {behavior:url('csshover2.htc');}
    	.test { background: #eee; width: 300px; height: 300px }
    	.test:hover { background: red; }
    	</style>
    </head>
     
     
    <body>
    	<div class="test">Testing</div>
    </body>
    </html>

  3. #3
    SitePoint Evangelist Karpie's Avatar
    Join Date
    Jul 2007
    Location
    Perth, Australia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've never been able to get those .htc hacks to work. Can't help you, sorry

  4. #4
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yeah, it seems a little flaky, but it's fantastic when it works, especially when so much of the site I've just made relies on it

  5. #5
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you set the MIME type in the .htaccess file that resides in the same directory as the file by any chance?

    If you have but it still doesn't work, try checking to make sure the paths are correct; failing that, move the .htc file and the MIME type declaration to the domain root (and remapping the paths from there).

    If tha doesn't work, contact your hosting provider to see if they changed any settings on the server recently.

  6. #6
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Many thanks for the reply Dan.

    I've just checked the .htaccess file and it says:

    AddType text/x-component .htc
    So hopefully that's okay.

    It's already in the domain root (wwwroot) too.

    It's all hosted on a local network, on an apache server, to be honest they're always playing around with the settings but I'm not sure what could effect this.
    Last edited by xkratosx; Jul 28, 2008 at 03:51.

  7. #7
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Actually, it must be a problem with my code. Just tried it on another server and it's still not working.

    I simply copied test.html (the code from my second post) along with the htaccess file and the htc file, and had no luck at all

  8. #8
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, then link the HTC file to it like so:

    behavior:url('/csshover2.htc');

  9. #9
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    I just copied your code from post #2 and pasted it exactly as you have it without changing anything and it worked straight away. (I already have the whatever hover file in the same directory.) Therefore there is nothing wrong with the code as such

    Therefore the issue is as Dan said in that you have moved the hover file or are not pointing to the correct location or your server settings have changed.

  10. #10
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Many thanks for the replies guys, and pmob for testing the code.

    I'm in a right mess though unfortunately, it just isn't working and I have no idea why.

    I've tried adding "/csshover2.htc" to point it to the root, but no change. I also tried copying and pasting the code from my test post above to try in Firefox (the code that worked for pmob) but now it's not working at all with classes, only IDs.

    It's so annoying, becuase there's a few fundamental things on the site that require this, yet it suddenly stopped working. The site's live too and has quite a few visitors (intranet btw) which makes it even worse

  11. #11
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Doesn't even hover in Firefox now.

    Code HTML4Strict:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    	<style type="text/css">
    	body {behavior:url('/csshover2.htc');}
    	.test { background: #ffc; height: 200px; cursor: help; }
    	.test:hover { background: #900; font-size: 999%; color: #fff }
    	</style>
    </head>
     
     
    <body>
    	<div class="test">Testing</div>
    </body>
    </html>

    .. yet changing it from class to ID (and . to #) works fine. What.

  12. #12
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Doesn't even hover in Firefox now.
    It will work in Firefox if you add a doctype and get out of quirks mode.

    Do yu have a working copy of the exact problem that we can look at.

  13. #13
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You sir, are my hero.

    Just added a doctype and it's working a treat now, thank you very much!

    Managed to get the live site working now too, but :focus isn't working - it was fine before, but now it's stopped.

    Edit: Doesn't work on that test page either:

    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    	<style type="text/css">
    	body {behavior:url('/csshover2.htc');}
    	.test { background: #ffc; height: 200px; cursor: help; }
    	.test:focus { background: #900; font-size: 999%; color: #fff }
    	</style>
    </head>
     
     
    <body>
    	<input type="text" class="test" value="Testing" />
    </body>
    </html>
    It'd odd, as like I said it was working fine before, and csshover2.htc should have the :focus attribute support right?

    Sorry to be a pain, but this has really got me stumped :/

  14. #14
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    The comments at the site say that it supports focus in a roundabout way (it uses "unknown" to trigger focus) but I can't see an example anyway where focus is working in IE6. The :active seems to work OK but :focus (which IE6 doesn't understand anyway) isn't working in my version either.

    This is more of a javascript question now that a css one

  15. #15
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Many thanks for the reply, that's really odd though, as I'm absolutely certain the focus attribute was working fine before.

    I'll change it to :active and see how I get on anyway, thank you

  16. #16
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    :active doesn't work either unfortunately Any suggestions please guys? Hover isn't working in some cases either, it all just seems slightly flaky...

  17. #17
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    I can't seem to get the focus working on that whatever:hover (despite reading the instructions which say it should work). The active seems to be working ok though but of course isn't the same as focus.

    Looking at the code there seems to be something wrong here.

    Code:
    var csshoverReg = /(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active))|((a|input|textarea)([#.][^ ]+)?:unknown)/i,
    If you add "unknown" before the a|input|textarea check you can get it working.

    Code:
    var csshoverReg = /(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active|unknown))|((a|input|textarea)([#.][^ ]+)?:unknown)/i,
    But of course that applies it to all elements and not just a, input or textarea as per normal.

    I'm afraid my regular expression knowledge is nil so it seems to be a javascript question now.

  18. #18
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    396
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Argh! The forum keeps losing my posts.

    The :hover attribute is working an absolute treat now - not bad at all for someone with nil regular expression knowledge! Very impressive

    Thank you so much


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •