SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)

    Book help: Relative causing Firefox to jump to top

    One of our books, Simply Javascript, seems to have some CSS compatibility trouble when creating rich tooltips.

    I'm posting this in the CSS forum in case anyone here can find a solution to be put forward to the book author.

    Page 132 of the book is where the Rich Tooltips example can be found, and page 138 is where we're told to apply a CSS fix for Safari and Opera.

    Code javascript:
    // Fix for Safari2/Opera9 repaint issue
    document.documentElement.style.position = "relative";

    The problem, is that when using Firefox in situations where you have scrolled down the page, setting this position to relative forces the web browser to scroll to the top of the page, and you lose the fancy tooltip.

    The issue has been diagnosed in the JavaScript forum at:
    http://www.sitepoint.com/forums/show...99#post4746899

    While it's possible to fix this problem using browser sniffing, it's better if that sort of technique was not required.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  2. #2
    SitePoint Guru Chroniclemaster1's Avatar
    Join Date
    Jun 2007
    Location
    San Diego, CA
    Posts
    784
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At Event Apart, they were recommending a new JS library called Modernizr for this kind of thing. It uses feature sensing rather than strict browser sniffing, but I haven't used it. Would something like that be workable, or is it being oversold?
    Whatever you can do or dream you can, begin it.
    Boldness has genius, power and magic in it. Begin it now.

    Chroniclemaster1, Founder of Earth Chronicle
    A Growing History of our Planet, by our Planet, for our Planet.

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Chroniclemaster1 View Post
    At Event Apart, they were recommending a new JS library called Modernizr for this kind of thing. It uses feature sensing rather than strict browser sniffing, but I haven't used it. Would something like that be workable, or is it being oversold?
    Object detection is much better than browser sniffing. Sadly I don't know enough about the Safari or Opera bugs, or the darker sides of CSS.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    What has me confused is that the RP fix for Opera-9 doesn't even seem to be working correctly. If I scroll the page any the tooltip loses it's positioning to the anchor. Or am I missing something?

    http://www.css-lab.com/test/tooltip-bug/test.html

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Rayzur View Post
    Hi Paul,

    What has me confused is that the RP fix for Opera-9 doesn't even seem to be working correctly. If I scroll the page any the tooltip loses it's positioning to the anchor. Or am I missing something?

    http://www.css-lab.com/test/tooltip-bug/test.html
    I don't think you're missing anything. I suspect that the tooltip code just wasn't tested in a scrolled page situation.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Okay, just wanted to check.

    If I were you I would remove the fix altogether since it works fine in Opera-10 without it. That gets FF working as well.

    Seeing how Safari-2 is a long gone it just looks like a counterproductive fix for this day and age.

    It's working fine in Safari-4+ and Chrome too.

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Thanks Ray - I'll copy that advice over to the original thread.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •