To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-09-2006, 01:20 PM   #1
szym9341
Senior Member
 
Join Date: Dec 2003
Location: Michigan
Posts: 130
PHP & DHTML Spinner Issue

The following code is from an opensource example on IBM's Developers site. The basic code works fine, but when I have more than one line hidden within a spinner, IE shows a large white gap when the spinner is closed. Is visibility:hidden an issue? Is it a PHP issue?

any help would be great.

PHP Code:
<?php
function start_spinner( $id, $title )
{
?>
<div class="item-header">
<a href="javascript:spin('<?php echo( $id ); ?>')"
  id="<?php echo( $id ); ?>">open</a> <?php echo( $title ); ?>
</div>

<div class="item-body" id="<?php echo( $id ); ?>_body">
<?php
}

function
end_spinner()
{
?>
</div>
<?php
}
?>
<html>
<head>
<title>Spinner Example</title>

<style type="text/css">
body { font-family: arial, verdana, sans serif; width: 800px; }
.item-header a { font-size: small; }
.item-header {
  font-weight: bold; border-bottom: 1px solid black;
  font-size: x-large;
}
.item-body {
  margin: 0px;
  font-size: small;
  visibility: hidden;
  height: 0px;
}
</style>

<script>
function spin( obj )
{
  var spinner = document.getElementById( obj );
  var spinner_content = document.getElementById( obj+"_body" );
  if ( spinner_content.style.visibility == 'visible' )
  {
    spinner.innerHTML = 'open';
    spinner_content.style.visibility = 'hidden';
    spinner_content.style.height = '0px';
    spinner_content.style.margin = '0px';
  }
  else
  {
    spinner.innerHTML = 'close';
    spinner_content.style.visibility = 'visible';
    spinner_content.style.height = 'auto';
    spinner_content.style.margin = '20px 0px 20px 50px';
  }
}
</script>

</head>
<body>

<?php start_spinner( 'lev1', "Level One" ); ?>
<p>This is the content of level one.</p>
<p>This is the content of level two.</p>
<p>This is the content of level three.</p>
<p>This is the content of level four.</p>
<?php end_spinner( ); ?>

<?php start_spinner( 'lev2', "Level Two" ); ?>
This is the content of level two.
<?php end_spinner( ); ?>

</body>
</html>
szym9341 is offline   Reply With Quote
Old 05-23-2006, 05:36 AM   #2
bogu
I code 4 beer ...
 
bogu's Avatar
 
Join Date: Nov 2002
Location: Romania
Posts: 1,743
I made a little modification of the script:

PHP Code:
<?php
.........
.
item-body {
  
margin: 0px;
  
font-size: small;
  
display: none;  // this line
  
height: 0px;
}
</
style>

<
script>
function
spin( obj )
{
  var
spinner = document.getElementById( obj );
  var
spinner_content = document.getElementById( obj+"_body" );
  if (
spinner_content.style.display == 'block' )   // this line
  
{
    
spinner.innerHTML = 'open';
    
spinner_content.style.display = 'none';   // this line
    
spinner_content.style.height = '0px';
    
spinner_content.style.margin = '0px';
  }
  else
  {
    
spinner.innerHTML = 'close';
    
spinner_content.style.display = 'block';   // this line
    
spinner_content.style.height = 'auto';
    
spinner_content.style.margin = '20px 0px 20px 50px';
  }
}
</script>
.............
__________________
/**
* The answer is so obvious, duh!
* It's like, whatever ...
*
* If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"
*/
bogu is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:10 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.