Member Avatar for ZethSchlenker

Here is the script I'm using:

$(function () {
	$('#nav a[title=toggle]').click(function() {
		$('#user').slideToggle();

	});
});

However, when I click the Toggle link located on the nav bar, it slides the #user up, and immediately slides #user back down.

Here's the CSS for #user:

#user {
	z-index:1;
	position:fixed;
	left:0px;
	width: 100%;
	margin-top: -40px;
	padding-top: 50px;
	height: 40px;
	background:#09F;
	color:#FFF;
	font-weight: bold;
	-webkit-border-radius: 10px;
}

Do you have an url where we can see ?

inside head metas --- jquery code
then outside head metas, inside body metas ----- your scripts code

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Random-Happens | Contact</title>
<link href="random-happens_files/styles.css" rel="stylesheet" type="text/css">
<script src="random-happens_files/jquery-1.js" type="text/javascript"></script>
</head><body>
<center>
<div id="container">
<div style="display: block;" id="user">

<script src="random-happens_files/scripts.js" type="text/javascript"></script>
Member Avatar for ZethSchlenker

Ah, I found the error. Even though your suggestion wasn't the right one (to fix the error that is), it made me look in a file I forgot about. Turns out I was calling the script twice, which was making it toggle the #user twice. Thank you very much! :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.