Documente Academic
Documente Profesional
Documente Cultură
com
WAY 2
This second way here is like the first in that it has no effects but this go aro
und you can actually toggle to hide/unhide the content. Like before you stick th
e following code in the HEAD section.
<script type="text/javascript">
function unhide(divID) {
var item = document.getElementById(divID);
if (item) {
item.className=(item.className=='hidden')?'unhidden':'hidden';
}
}
</script>
Now you specify the CSS (that means the following goes in the CSS section), depe
nding on what you want achieved you will say display or visibility:
.hidden {display: none;}
.unhidden {display: block;}
Display means that if it is display:none the space of the content is not still t
here. Aka will collapse the space.
WAY 3
The next two ways have effects related to them so if you're wanting a way to sho
w things more snazzily these would be for you.
WAY 3 EXAMPLE
The nice thing about this way is the transition and how it sort of glides out th
e content that you want to reveal and is easy to use. The following javascript r
ight above where you want to use it:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".sub").hide();
//toggle the componenet with class msg_body
jQuery(".cthrough").click(function()
{
jQuery(this).next(".sub").slideToggle(500);
});});
</script>
Also check in case you don't have a jquery script in your HEAD area already. If
you don't put the following in your HEAD area.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></
script>
Then you just mark up the HTML for the javascript to recognize:
WAY 4
This last way is the last for a reason - because it's more code intensive and do
esn't rely on javascripts to reveal things. It uses transitions. So, if you aren
't comfortable with CSS/HTML this way is most likely not for you.
Unlike the rest of the ways this way doesn't require that you click on it to rev
eal your content but merely just hover over. So again, if you're wanting a click
action instead this is not the way you most likely want to use.
For this way all you really need is CSS and HTML but the draw back is you will n
eed to know a more approximate height for what you are revealing.
First let's look at why this is in the CSS:
#bx {height: 15px; overflow: hidden;
transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;}