PDA

View Full Version : Javascript / DHTML problem on Firefox Mac




joezandstra
Feb 27, 2006, 09:37 AM
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>



Happyeyeball
Oct 19, 2006, 08:26 PM
Hi joezandstra,

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

Many thanks, Jeffrey

joezandstra
Oct 21, 2006, 06:38 PM
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