Jump to content

Recommended Posts

Posted

I need like an expand and collapse column, I believe i will need javascript to do it but am not sure. could anyone show me a script that shows more or less for example like the youtube description boxes.

Posted

Something like this should work.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<script type="text/javascript">
function hideElement(i) {
var e = document.getElementById(i);
if (e) {
e.style.visibility = 'hidden';
}
}

function showElement(i) {
var e = document.getElementById(i);
if (e) {
e.style.visibility = 'visible';
}
} 
</script>
<title>Test Page</title>
</head>
<body>
<div id="showhide">
The Text<br/>
<a href="java script:hideElement('showhide')">Hide</a><br/>
</div>
<p>
<a href="java script:showElement('showhide')">Show</a><br/>
</p>
</body>
</html>

Posted

jQuery could also be used for this i think. using their slideDown() and slideUp() functions. i have used a similar technique on one of my projects.

 

slideDown(): slideDown

slideUp(): slideUp

 

 

  • 5 months later...
Posted
jQuery could also be used for this i think. using their slideDown() and slideUp() functions. i have used a similar technique on one of my projects.

 

slideDown(): slideDown

slideUp(): slideUp

jQuery should work a treat!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...