Results 1 to 10 of 10

Thread: [help] question about hover

  1. #1
    Join Date
    Jul 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default [help] question about hover

    Is that hover only available for link?
    I try to use hover for table, but it failed to display the effect. After that, i try on font but it still cannot work.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The :hover pseudo-class is meant to be available for all elements. However, there is (yet another) bug in IE that causes it to work only on <a> elements with hrefs.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    IE................ -.-|

    Anyway, thanks for your help.
    I think i will continue work on Javascript to come out the similiar effect

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by s00263668
    IE................ -.-|

    Anyway, thanks for your help.
    I think i will continue work on Javascript to come out the similiar effect
    You can do that but, oftentimes it is better to make it a link and use css. You can use this href:

    href="javascript:void(0);"

    That way clicking will do nothing. Then you can style the link anyway you like. Often it is useful to set its display:block; and, if contained in say a table cell, its height and width to 100%.

    The advantage to using css is that it is much more universally supported than javascript effects.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    You can do that but, oftentimes it is better to make it a link and use css. You can use this href:

    href="javascript:void(0);"

    That way clicking will do nothing. Then you can style the link anyway you like. Often it is useful to set its display:block; and, if contained in say a table cell, its height and width to 100%.

    The advantage to using css is that it is much more universally supported than javascript effects.
    sorry, i'm quite new to web page design. Can you tell me what is the use for "javascript:void(0);"?

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by s00263668
    sorry, i'm quite new to web page design. Can you tell me what is the use for "javascript:void(0);"?
    Sure. With javascript active, it is the only 99.9999% certain to do nothing href I have ever come across. With javascript disabled, the odds of it doing nothing increase.

    In more technical terms, the javascript: construct used as a preface for an href tells the browser that what follows is javascript code rather than a URL. The void() method prevents the script parser from taking most default actions. In the case of an href, that would be to load the URL or javascript output directly into the window, replacing the current page. Void() prevents this from happening. The 0 is just that, nothing. So, we have invoked the script interpreter, told it not to replace the page and told it not to do anything else. Just as a matter of convention, virtually all non-javascript enabled browsers will interpret this code as 'do nothing'.

    For hover css, it allows an anchor element to have an href as required by IE. Once that has been satisfied, you can style the anchor tag in virtually any way that you please. You can make it mimic a <p>, <span>, <div> or <td> and even wrap it around an <img> or a <table>. The possibilities are quite numerous.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Quote Originally Posted by John
    Sure. With javascript active, it is the only 99.9999% certain to do nothing href I have ever come across. With javascript disabled, the odds of it doing nothing increase.
    Haha, nice.
    The void() method prevents the script parser from taking most default actions. In the case of an href, that would be to load the URL or javascript output directly into the window, replacing the current page. Void() prevents this from happening.
    Somewhat oversimplified. With javascript: URLs, the Javascript statement is evaluated, then the browser attempts to navigate to that value. For example:
    Code:
    javascript:'mypage' + '.' + 'html';
    would try to go to "mypage.html". void (which isn't actually a function but a unary operator; it functions equally well without the brackets in Javascript-enabled browsers) ensures that no value is returned, thus causing the browser not to navigate away from the page.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Jul 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    wow, thanks for help. It will be very interesting if I could wrap the link in image.

    Code:
    <tr><td class="hoverEffect">
    <a href="javascript:void(0);">example.htm</a>
    </td></tr>
    here is my code. However, i found that the effect can't fill the whole cell.
    is there any error in my coding?

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That doesn't really tell us much. It is the style that drives the whole thing. Using the markup you show in your above post, you would need to at least set the style like so for the anchor link in your stylesheet:

    Code:
    .hoverEffect a {
    display:block;
    width:100%;
    height:100%;
    }
    
    .hoverEffect a:hover {
    whatever you want it to do
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Jul 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks john

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
  •