![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Dec 2003
Location: 1123,6536,5231
Posts: 3,397
|
CSS/JS - Div show hide
I need a script that will allow me to show hide content inside of a div. I managed to get one working fine, super simple - but my JS sucks so I can't build on it.
I need for when you click a SECOND link the div opens and closes any other opened divs of the same class/ID. So basically just a tab system. Anyone have a super simple one available? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Sofa King Band
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
|
function showDiv(x){
if(document.getElementById(x).style.display == 'none'){ document.getElementById(x).style.display = ''; } else { document.getElementById(x).style.display = 'none'; } } <input type="button" onclick="showDiv('divname');"> That one won't work the other "tabs" but it's pretty easy to add in.... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Dec 2003
Location: 1123,6536,5231
Posts: 3,397
|
yea that's pretty much what I have already. it keeps the old div open when you click a new one. means if I have 19 elements, they all get stacked. I want to close previous ones when a new one is opened.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
|
http://fdsign.com/jeff/ams-final2/products.html
choose a product and click "supplement facts" to see it work code: Code:
<SCRIPT LANGUAGE="JavaScript"> function showElement(element) { var target = document.getElementById(element); target.style.display='block'; } function hideElement (element) { var target = document.getElementById(element); target.style.display='none'; } </SCRIPT> Code:
<DIV Name="id2" ID="id2" style="display:none; width:98%;height:auto;position:middle center;z-index:100;"> <img src="1-DAfacts.jpg" /> <div style="clear:both;background-color:#444444;border:1px #FFF solid;font-size:12px;font-weight:bold;padding:3px;"><A HREF="#nowhere" onclick="hideElement('id2');"><img style="padding:4px; border:0;"src="close.gif" /></A></div></DIV> <div class="pic"><img src="androsterone.jpg" alt="Androsterone" style="padding-left:5px;"/><a href="faq.html"><p><img src="faq.gif" alt="Frequently Asked Questions" style="border:0; padding-top:15px;"/></a></p><A HREF="#nowhere" onclick="showElement('id2');"><img src="supplement.gif" alt="Supplement Facts" style="border:0; padding-top:15px;"/></a></p></div>
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
I make pixels work
Industry Role:
Join Date: Jun 2005
Location: I live here...
Posts: 24,386
|
I think i just made a mess in my pants...
CSS and JS makes me hard!
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Jan 2005
Location: Stockton
Posts: 4,365
|
Try changing the z-layer
__________________
ICQ:268731675 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
If you happen to use dreamweaver cs3, search for spry tutorial on youtube, it's super easy to setup even for someone who doesn't know shit about javascript...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager ![]() Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Now choke yourself!
Industry Role:
Join Date: Apr 2006
Posts: 12,085
|
I don't know why, but I smirked for some reason.
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
www.dynamicdrive.com should have what you're looking for, and if they dont they'll custom tweak stuff in the forum for you. very helpful site and users helping each other out
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Nov 2004
Location: scv
Posts: 2,299
|
I use jquery for stuff like that. Sounds like you're looking for something like this... http://docs.jquery.com/UI/Accordion
I've tried mootools and prototype and like jquery the most. Even if you aren't great with JS, this helps a ton. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 | |
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
|
Quote:
![]()
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth |
|
![]() |
![]() ![]() ![]() ![]() ![]() |