1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Javascript / DHTML problem on Firefox Mac

Discussion in 'Web Design and Development' started by joezandstra, Feb 27, 2006.

  1. macrumors newbie

    #1
    Hi,
    I'm having a strange problem getting some simple code to work on Firefox (Mac). It works fine in Safari and all major PC browsers...

    I have a hidden DIV that is full of scrolling content and I have set "overflow: auto" so that it scrolls within the div. The DIV hides fine on all browsers but Firefox where the scrollbar (but none of the content) displays.

    I have searched everywhere online for an answer but can't seem to find any bugs reported about Firefox displaying the scrollbars of hidden DIVs. I expect there's something fundamental wrong with my code. I'd be very grateful for any pointers. Below is the code I'm having trouble with:



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>

    <style type="text/css">
    <!--
    .content {
    color: white;
    padding: 10px 10px 10px 10px;
    height: 300px;
    width: 300px;
    visibility: hidden;
    background-color: green;
    overflow: auto;
    }
    -->
    </style>

    <script type="text/javascript">
    <!--

    function showhide(sublink) {

    if(document.getElementById(sublink).style.visibility == 'hidden')
    {
    document.getElementById(sublink).style.visibility = 'visible';
    }
    else
    {
    document.getElementById(sublink).style.visibility = 'hidden';
    }
    }

    // -->
    </script>

    <title>Mac Scrollbar Firefox Issue with hidden div, overflow: auto</title>
    </head>
    <body>

    <a href="Javascript:showhide('divtest')">Click to show hidden div</a>

    <div id="divtest" class="content" style="visibility: hidden;">
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac?? On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    On the PC (Firefox, Opera, IE) and Safari for the Mac, this div is hidden and the scrollbar is hidden too. How do I stop a disembodied scrollbar from appearing on Firefox for Mac??
    </div>


    </body>
    </html>
     
  2. macrumors newbie

    #2
    Javascript / DHTML problem on Firefox Mac

    Hi joezandstra,

    Did you ever find a fix for this problem? I'm running into the same thing.

    Many thanks, Jeffrey
     
  3. macrumors newbie

    #3
    Hi Jeffrey,
    It was such a while back that I've forgotten exactly how I solved the issue - but I did - through trial and error - discover a workaround.

    I believe it had something to do with the syntax of the styles in the head of the document paired with the visibility attribute for the DIV in the body... but it was a while ago and I'm no coder.

    Best thing I can do is point you to the site I was building at the time:
    (this is a preloader that redirects to the actual file)

    http://www.joezandstra.com/index1.html

    Good luck!

    Joe
     

Share This Page