...

View Full Version : jQuery Toggle Help



gfadmin
08-08-2009, 05:08 AM
Ok i have this 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



$("#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

gfadmin
08-08-2009, 05:34 AM
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

1andyw
08-08-2009, 09:29 PM
Try using
display:none; in the css for the divisions you wish to be hidden.

Andy

Uzbekjon
08-13-2009, 02:18 PM
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.


$(document).ready(function(){
$("#popupbg").hide();
$("#popup").hide();
});



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum