Jump to content

[SOLVED] Non show in IE7, hidden class change


Recommended Posts

Hello

 

I have this problem with a class change script. basicly on page load there is hidden sections under there building names and when you click a link javascript changes the class name to reveal what was hidden onload which is a div that contants a table that lists units available in the building

 

see http://www.units-to-let.co.uk/searchResults.php?pc=NG6+0EB

 

the first listing Testing 2 click the link "Click here to view units" and see what i mean, it works fine in IE8, firefox and other browers but not IE7 (strange thing is when i clicked print preview in IE7 it shown what it wasnt showing on the webpage in the print preview)

 

To make things easier below is the code.

 

CSS

.hiddenToU {
visibility: hidden;
height: 0px;
}

 

JS

<script type="text/javascript">
<!--
function hideReveal(id) {
var getDir = document.getElementById(id).className;
if(getDir=='hiddenToU') {
	document.getElementById(id).className = "";
} else {
	document.getElementById(id).className = "hiddenToU";
}
}
//-->
</script>

 

HTML

<div id="<?php echo $row_buildingsRS['bid']; ?>" class="hiddenToU">
                <table width="330" border="0" style="margin-left:42px;border:1px dashed #2C5380;">
                  <tr>
                    <th width="74" align="center"> </th>
                    <th width="49" align="center" bgcolor="#2C5380">Unit</th>
                    <th width="110" align="center" bgcolor="#2C5380">Size</th>
                    <th width="80" align="center" bgcolor="#2C5380">Rent</th>
                  </tr>
                  <?php 
                $bid = $row_buildingsRS['bid'];
                echo getUnits($database_utl, $utl, $bid); ?>
                </table>
               </div>

 

If i remove the height:0; from the CSS it shows what it should do on screen in IE7 but you get the large gaps between names where the hidden data should be when hidden which looks messy and is the reason i put height:0; in

 

Any help would be great thank you.

Once you click the link to open up what units are in the building buy pressing the "Click here to view units" javascript changes the class of the hidden div so it reveals what units are available in that business building, in IE7 when you click it makes the space for the hidden data but don't display it.

So what's the problem, specifically?  The only difference I can see in IE7 is the lack of dashed border.

 

So image one is how it looks in IE7 while the units data are hidden before you click to view more units

utl-IE7-Hidden.jpg

 

This is what it looks like when you click view units

utl-IE7-open.jpg

 

This is what it should look like and is working on FF3, IE8 and others

utl-FF3-should_look_like.jpg

 

hope this helps more

Quick fix for your function.  Try:

 

function hideReveal(id) {
   var myDiv = document.getElementById('id');

   myDiv.className = (myDiv.className == "hiddenToU") ? "" : "hiddenToU";
}

 

Thank you but this just did the same as my code, just what the images show

Thank you, have tried that but no luck, im 100% sure it has something to do with the css rule height.

 

I set the height to 0px so it don't leave the spaces between buildings names but if i don't use the height rule at all in the hiddenToU class it works fine other then leaving the space where the div/table should be which looks messy.

 

On reveal i cant specify a height for it to then use as each building will have a different amount of units under it.

after looking around the net for a work around it came to my attention that its a bug in IE and a work around was to use span tags around all the table cells and use some display css, as that wasn't a fix for me it gave me an idea though

 

CSS

.hiddenToU {
position:absolute;
left:-30000px;
}
.revealToU {
visibility:visible;
}

 

Thank you for any help

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.