Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-08-2009, 04:08 AM   PM User | #1
gfadmin
New Coder

 
Join Date: Jul 2009
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
gfadmin is an unknown quantity at this point
Question jQuery Toggle Help

Ok i have this code

Code:
<script src="jquery-1.3.2.js" type="text/javascript" /></script>
          <script type="text/javascript">
               $(document).ready(function(){
										  
                   $('#popuptoggle').click(function(){
                        $('#popupbg').toggle('slow');
                   });
				   
				   $('#popuptoggle').click(function(){
                        $('#popup').toggle('slow');;
                   });
				   
              });
          </script>
now i want the divs with the id popup and popupbg to be hidden when the page is first loaded so i tried this

Code:
 $("#popupbg").hide();
					
$("#popup").hide();
and it worked but they dont toggle hide/show.

also can i get the div to be hidden right when the page loads because right now its there until the page loads then it hides
__________________
SkyePHP | Head Developer & Project Manager.
Release: TBA
Like the Facebook Page for Updates!
gfadmin is offline   Reply With Quote
Old 08-08-2009, 04:34 AM   PM User | #2
gfadmin
New Coder

 
Join Date: Jul 2009
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
gfadmin is an unknown quantity at this point
I will also mention that the divs are in a file(video.php) that is included in index.php via a switch statement. and the jQuery code is between the <head> and </head> tags in index.php

Index.php ----Switch Statement---> video.php
|
jQuery Code
__________________
SkyePHP | Head Developer & Project Manager.
Release: TBA
Like the Facebook Page for Updates!
gfadmin is offline   Reply With Quote
Old 08-08-2009, 08:29 PM   PM User | #3
1andyw
Regular Coder

 
Join Date: Jul 2006
Posts: 171
Thanks: 13
Thanked 1 Time in 1 Post
1andyw is an unknown quantity at this point
Try using
Quote:
display:none;
in the css for the divisions you wish to be hidden.

Andy
1andyw is offline   Reply With Quote
Old 08-13-2009, 01:18 PM   PM User | #4
Uzbekjon
New Coder

 
Join Date: Feb 2009
Location: Uzbekistan
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Uzbekjon is an unknown quantity at this point
1andyw's solution is the best way to go.

Also, I would also like to point out that if you'd put your div hiding code into the document ready it would have worked as well. Just pointing it out so that others don't get confused.

Code:
$(document).ready(function(){
  $("#popupbg").hide();
  $("#popup").hide();
});
Uzbekjon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:22 PM.


Advertisement
Log in to turn off these ads.