Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.