Show/Hide Toggle On Multiple Divs?

Oct 24, 2010

On the homepage of my site, I would like to have some nav links that toggle between a few divs that are below in the content The divs in the content should display one at a time. For example, if you click nav1, the user would see div1. If nav2 is then clicked, div1 would hide and div2 would display.

I have some code that will do this, but for some reason it is hiding any divs that are within the toggled div. I'm very basic with JS and could use some help here. Here is my code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
function toggleID(IDS) {
var area = document.getElementById('secondContent');
var sel = area.getElementsByTagName('div');

[Code]...

View 1 Replies


ADVERTISEMENT

Multiple DIVs Toggle Show/Hide?

Dec 7, 2010

Complete JS first timer here, hope you all can understand my difficulties and stupidities without getting too frustrated. Trying to make a portfolio website as a Christmas gift. Anyway, I'm trying to build a menu that:

1. Expands/Retracts when clicking on other 'headers' in the Menu.
2. Allows for more than one object to be listed in each 'header'.

(Something similar to this [URl]... I've tried to hatch together several online solutions but I really have no idea what I'm doing, as you can see:

[Code]...

View 1 Replies View Related

JQuery :: Show / Hide Divs Using Toggle?

May 24, 2011

Completely new to jQuery but I am trying to implement a few pieces on my new website. At the moment I have three images in a row and I want to be able to click on any one of the images and use jQuery to populate a hidden div below the three images that contains more info and slide it out using the fold animation. I'd also like it if when a second image was clicked it closed the currently open div and opened the new one. I've seen tutorials that open the divs but can't find one that closes them again on opening a new one.

Can anyone point me to a tutorial that does this or suggest how it could be done?

View 2 Replies View Related

JQuery :: Toggle - Hide Show 2 Divs With One Button

Jul 28, 2010

I have 2 divs: <div id="box1></div> and <div id="box2></div> I also have one link to contoll them both. The effect I want to get is: when I click first time on my link box2 hides, when i click second time also box1 hides, when I click third time both divs should show. I manage to do that both divs hiding but later I can't get the show. Im trying sth like this:

$(document).ready(function() {
$('.slick-hide').click(function() {
$('#box2').hide('fast');
$('.slick-hide').click(function() {
$('#box1').hide('fast');
$(".slick-hide").removeClass("slick-hide").addClass("slick-show");
$('.slick-show').click(function() {
[Code]...

View 2 Replies View Related

Toggle (Show / Hide) Multiple Dynamic IDs?

Apr 3, 2010

Im trying to toggle a block of info on a forum that gets displayed multiple times. The below works for just one ID but I'll have more then one.

Code:
function toggle() {
var ele = document.getElementById("toggleUserinfo");
var text = document.getElementById("displayUserinfo");
if(ele.style.display == "block") {

[Code]..

View 5 Replies View Related

Toggle Show/hide On Multiple Ids Using Dynamic Array?

Jun 30, 2011

im trying to create an array with mutiple div ids. send this off to the function and the function switches the classes to show or hide depending on state.

[Code]....

View 3 Replies View Related

Script To Show & Hide Multiple Divs?

Jul 6, 2011

I found the following script online to show/hide a login div.

<script language="JavaScript" type="text/javascript">
function login(showhide){
if(showhide == "show"){
document.getElementById('popupbox').style.visibility="visible";
}else if(showhide == "hide"){

[Code]...

It works really well but I have other div I would also like to show/hide. Is it possible to have a variable in the function that I could pass the name of the div to show/hide.

I have a ul list that I am using for a navigation menu and I would like to be able to click on items in the list to show different div's. I assume this is possible, so could someone please give me an indication of how to do it as I have been trying for a few days now and no joy.

View 5 Replies View Related

Multiple Dropdowns With Show / Hide DIVs

Aug 11, 2010

I am using the following code to show / hide form elements within a div based upon the drop down choice. How this code can be amended to use multiple drop downs within one form?


HTML Code:
<html><head>
<title>Show and Hide</title>
<script>
// Function that Shows an HTML element
function showDiv(divID){
var div = document.getElementById(divID);
div.style.display = ""; //display div
}

// Function that Hides an HTML element
function hideDiv(divID){
var div = document.getElementById(divID);
div.style.display = "none"; // hide
} .....

View 6 Replies View Related

JQuery :: Show/Hide Divs For Multiple Selects?

Mar 25, 2011

I have a jquery function that will show or hide a div id="hide1" based on the result of a select id="ticket1"

$(document).ready(function(){
$('#hide1').hide();
$('#ticket1').change(function(){
if(this.value == 'adult'){$('#hide1').hide();}

[Code]....

It works well! But my script actually clones elements of the form so a user could be selecting adult or child for a number of tickets - ticket1,ticket2,ticket3....

How can I adapt that script so that it will show/hide for each ticket

View 4 Replies View Related

JQuery :: Show / Hide Multiple DIVs On Page?

Jul 11, 2011

I have a little issue with trying to hide / show multiple divs on my page. I am using a class name for the divs but the name is generated by a field have set in my database. So for example
<div class="General">Ttitle 1</div>
<div class="General">Ttitle 2</div>
<div class="General">Ttitle 3</div>
<!-- and my link is -->
<a href="#" class="toggle" title="General">Toggle 1</a>

And then say I have
<div class="Questions">Ttitle 1</div>
<div class="
Questions ">Ttitle 2</div>
<div class="
Questions ">Ttitle 3</div>
<!-- and my link is --><a href="#" class="toggle" title="
Questions ">Toggle 2</a>

What would be the easiest way or the best way to code out the jquery to hide / show all the divs with the same name as the links title i can do code jquery to toggle 1 div but not sure how to code it so that it will hide / show all the divs with the same class name.

View 5 Replies View Related

JQuery :: Show/hide Multiple Divs Independently?

Mar 28, 2010

Is there a way I can simplify my code below? I want to be able to have just one iteration of the code and have it automatically switch out the IDs without have to add a new bit of JavaScript with each new div that is added. Here's my Javascript:

$(document).ready(function() {
// toggles the personnel window on clicking the image/header
$('div.title'+'#one').click(function() {

[code]....

View 2 Replies View Related

JQuery :: Show Hide Multiple Divs Independently Without #ID?

Dec 5, 2009

I am new to jquery and need some help with this I have the following simplified html

[Code]...

View 2 Replies View Related

Multiple Drop Downs With Show / Hide Divs?

Aug 11, 2010

I am using the following code to show / hide form elements within a div based upon the drop down choice. Does anyone know how this code can be amended to use multiple drop downs within one form?

<html>
<head>
<title>Show and Hide</title>
<script>

[Code]...

View 1 Replies View Related

Show And Hide Multiple DIVs On Page - Add Cookies?

Jul 12, 2009

I use this script to show/hide multple divs on a page. I am trying to adding cookies to this script.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]"><head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Show Hide</title>
<script language=javascript type='text/javascript'>
function hideSpan(pass) {
var spans = document.getElementsByTagName('span');
for(i=0;i<spans.length;i++){
if(spans[i].id.match(pass)&&spans[i].style.visibility){
spans[i].style.visibility=spans[i].style.visibility=="hidden"?"visible":"hidden";
}}}
</script></head><body>
<span id="256a" style="visibility:hidden;" >
My content<br/>
</span><span id="256b" style="visibility:hidden;">
<br/></span>
<span id="512a" style="visibility:hidden;">
<br/></span>
<a href="javascript:hideSpan('256')">show/hide span 256</a>
<a href="javascript:hideSpan('512')">show/hide span 512</a>
</body></html>

View 3 Replies View Related

JQuery :: Hide / Show Multiple Divs From Anchor Tags?

May 3, 2011

I've got an issue with the attached file.

I have 3 buttons & 3 divs.

I would like to hide/show the relevant divs (into a container) based upon the button pressed. If no div was open, then it would simply open the relevant div, however if say div 2 was open and div 3 was pressed, div 2 would toggle closed then div 3 would toggle open.

I've got each individual div opening and closing, but I'm stuck at the next point (checking if a div is open/toggling etc).

View 5 Replies View Related

Show Hide Multiple Divs Based On One Div And Search Text?

Jun 14, 2011

I am going to achieve something like this.

<div id="sidebar">
<div id="html1"><h2>Test 1</h2></div>
<div id="html2"><h2>a1 tes2</h2></div>
<div id="html3"><h2>a2 tes3</h2></div>
</div>

The thing is that first I need to detect if the div id is "sidebar" if its "sidebar" then it will pickup all the text inside h2 tag and will search for a1 or a2 in the text.If a1 is found then it will pickup the id html2 and make this div only visible.So in this case it will pickup id html2 and make it visible while other ids like html1 and html3 will be hidden.

View 2 Replies View Related

JQuery :: Toggle Function - Hide/show Table When Hide/show Button Is Pressed

Sep 12, 2011

I am trying to hide/show table when hide/show button is pressed

Problem: The code works fine when I remove 'slow' from line 10. But with 'slow' in line 10 content of toggleButton doesnt change from Hide to Show when pressed.

Code:

View 1 Replies View Related

JQuery :: Show Two Separate Divs, Hide Divs On One Click?

Aug 19, 2009

I'm looking for some javascript to work with wordpress (jQuery preferrably) that will show/hide multiple divs on one click.

I had one working but it was kinda janky because it was causing me to have two divs with the same ID on one page. No good.

Since I updated to wp2.8.3 prior to launch, it's not working. So I've decided to just try and do it right.

Here's a page: [URL]

So, what I want to happen: On page load, the first tab: "general" and it's corresponding div beneath should be showing. And the first image should be showing. The other content divs and images should be hidden. I've given the text content divs a dashed border to show their borders. When a visitor clicks "dine at home" the general div and image hide, the second content div shows, as does the second image (it's currently the identical image, but the client may change later.) Etc.

I'll be using this function on a few other pages as well.

how to adjust this javascript to work on two different IDs at once?

current code:

Code:
<script type="text/javascript" charset="utf-8">
$(function () {
var tabContainers = $('div.imgswap > div');

[Code]....

View 2 Replies View Related

One Function To Toggle Multiple Divs?

Mar 30, 2011

I will have a page with about a 100 or so different links and I would like each one to toggle the visibility of its corresponding hidden div.For instance, if I have a county 'Johnson' when it's clicked I would like the hidden div associated with that county to become visible. I would like to do this without having to write a different function for each one. Is there a way to do this easily?

Below is a solution I was given elsewhere but I couldn't get it to work.Most ideal of all I would like it to work with an image map, with each county having it's own set of stats to be toggled in.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>[code].....

View 9 Replies View Related

JQuery :: Multiple Divs Toggle With Click

Dec 18, 2011

I am trying to toggle multiple divs toggle open/closed show/hide with a slide left effect It works but is buggy if you click too fast [URL] I want to create this but control to content in the sliding divs [URL]

View 1 Replies View Related

Multiple Checkbox Filter - DIVs Will Toggle

Oct 29, 2010

I am trying to make a multiple checkbox filter. It works by selecting/unselecting checkboxes the divs with classes revered to the checkboxes will activate deactivate.

This is the javascript I founded on the net:
Code:
<script type="text/javascript">
$(document).ready(function(){
$("#events li."+$("input.type_check").attr('id')).addClass('type_hidden');
$("#events li."+$("input.type_check").attr('id')).slideUp();
$("#events li."+$("input.start_check").attr('id')).addClass('type_hidden');
$("#events li."+$("input.start_check").attr('id')).slideUp();
$("#events li."+$("input.place_check").attr('id')).addClass('type_hidden');
$("#events li."+$("input.place_check").attr('id')).slideUp(); .....
To see it working online look here: [URl]

There two problems. I want to replace the sliding effect. I want to make a table with the divs in it. And when a div is deactivated the text or image shows grey and the link is disabled and when activated the text/image shows black/color and the link is enabled. So when you uncheck/check the boxes the divs will toggle between the two styles clickable and unclickable. I also want to make a second checkbox/radio row with different css styles to choose from. When a style is selected and you click on a link in div it will send you to the page with the selected style.

View 6 Replies View Related

Toggle DIV - Want To Only Show And Then Not Hide

Jan 25, 2010

I'm using a classic toggleLayer function to display content in a div adjacent to one full of links.

The code is
function toggleLayer( work ){
var elem, vis;
if( document.getElementById ) // this is the way the standards work
elem = document.getElementById( work );
else if( document.all ) // this is the way old msie versions work
elem = document.all[work];
else if( document.layers ) // this is the way nn4 works
elem = document.layers[work];
vis = elem.style;
// if the style.display value is blank we try to figure it out here
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

And the links take on the format of:
<a href="javascript:toggleLayer('work');...........
My problem is, I want the 'work' div to remain blank, which it does, until I click one of the links. But after that initial click, I don't want the script to act as a toggle, just a show/change content.

View 1 Replies View Related

Onclick - Toggle To Show/ Re Hide The Div

Mar 3, 2009

Im trying to hide a div ( quick reply box) like IPB using this code it's hidden but the actual link to toggle it isn't a live link for some reason any idea's what im doing wrong would be good.

This is what i am trying to hide

Im not sure how i get this to toggle to show/ re hide the div.


<div id="myClickyDiv" onclick="swapMyToggledDiv();">Toggle</div>

View 3 Replies View Related

Show/hide Toggle Slidefx

Dec 21, 2007

Ive been trying different show/hide methods for like, a week now. And I cannot get a single one of them to work. Even a little bit

Ive no idea what I'm doing, I'm usually not so bad at figuring stuff out, at this point im going to punch things. haha

can anyone point me to a template that uses a show/hide function. Or a pre-made page using mootools fx.slide? I cant even get the demo there to do anything.

View 2 Replies View Related

Show One Div & Hide Two Other Divs

Apr 12, 2010

I have 3 divs containing images floated next to each other and when clicked i want a new div to appear beneath these 3 images. Clicking on the first image i want a new div to appear beneath these 3 images. Clicking on the second image must hide all other divs and only show the content for that div.

View 7 Replies View Related

JQuery :: Cookie In Show/hide Toggle Div

Apr 15, 2011

My script:

Question:How can I insert a cookie to this, so that when I hide it, it will remain hidden after refreshing the page.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved