How am I able to do thissss? |
How am I able to do thissss? |
![]()
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() ![]() Group: Member Posts: 164 Joined: May 2008 Member No: 647,219 ![]() |
Okay, So I realized I have a lot of content on my website.
So I asked a suggestion, and They told me to have it hidden, and pretty much people click on it to Bring the rest up, instead of going to a new page to get it all, it can just appear, and disappear by View more, or Hide the rest, etc. http://ego-box.com/ - Their Content bar, the View more, How do you do that? |
|
|
![]() |
![]()
Post
#2
|
|
![]() Member ![]() ![]() Group: Member Posts: 28 Joined: May 2009 Member No: 728,558 ![]() |
CODE <script language=javascript type='text/javascript'> function hidediv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){//if they are 'see' divs if (document.getElementById) // DOM3 = IE5, NS6 divs[i].style.visibility="hidden";// show/hide else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'hidden'; else // IE 4 document.all.hideshow.divs[i].visibility = 'hidden'; } } } function showdiv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){ if (document.getElementById) divs[i].style.visibility="visible"; else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'visible'; else // IE 4 document.all.hideshow.divs[i].visibility = 'visible'; } } } </script> Put that script in your header and for the content you want to hide put them in a div -ex. CODE <div id="whatever you name it"> Stuff you want to hide/show here </div> - the link that hides the content is: CODE <a href="java script:hidediv('whatever you name it')">hide this div</a> the link that shows the content is: CODE <a href="java script:showdiv('whatever you name it')">show this div</a> I hope this helps you!:] SOURCE
Reason for edit: Please use [codebox] and [code] tags respectively when posting codes. - Mike
|
|
|
![]() ![]() |