Jump to content

Simple toggle() issue


coupe-r

Recommended Posts

Hi All,

 

I just want a div to toggle when clicked.  However, when I click it for the first time, it slides down too far, then jumps back up really quick to where it should be.  When I click it again, it slides up perfectly?

 

Jquery:

<script type="text/javascript">
$(document).ready(function() {

$('#personal').click(function() {
	$('#personalContent').toggle(1000)
});

});

 

HTML:

<div id="personal" class="dashHeading">
<p><img src="../img/dashboard/arrow.png" width="20" height="20" /> Personal Information</p>
</div>


<div id="personalContent" style="display:none;">

     <p>This text slides</p>

</div>

Link to comment
https://forums.phpfreaks.com/topic/242646-simple-toggle-issue/
Share on other sites

the only thing that I notice is that you aren't ending you code line

 

<script type="text/javascript">
$(document).ready(function() {

$('#personal').click(function() {
	$('#personalContent').toggle(1000); // place a ; on the end here
});

});

other thatn that, I really don't see anything that would be causing this

Link to comment
https://forums.phpfreaks.com/topic/242646-simple-toggle-issue/#findComment-1246274
Share on other sites

OK cool,  can you help with a fade question?

 

Below is my fadeIn() code.  On clicking a div, it fades in.  What I want to do is have it fade out on a second click.  Thanks

 

$(document).ready(function() {

$('#employment').click(function() {
	$('#employmentContent').fadeIn('slow', function() {;

	});
});

});

Link to comment
https://forums.phpfreaks.com/topic/242646-simple-toggle-issue/#findComment-1246289
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.