Learning jQuery
-
Greetings and Salutations! I'm not sure if this is the right group for this, but if not, please let me know where I should post my questions. I'm a novice to the world of jQuery and I've run into a snag (and can use some help). When I include the following line in my HTML file, the element doe not slide down as expected:
$(document).ready(function(){ $("#ContentHeader").slideDown(4000); });
When I load the page the element appears without sliding down. I'm self taught using CodeAcademy and a text titled: "JavaScript & jQuery: The Missing Manual". Do I have the syntax correct? Here is the full code I'm using:
<html lang="en">
<head><script> $(document).ready(function(){ $("#ContentHeader").slideDown(4000); }); </script>
</head>
<body>Andre Mitchell Stevens Swagger
Ain't it cool???
</body>
</html>======================= Every experience in life is a lesson to be learned A. Stevens B.S., Computer Science
-
Greetings and Salutations! I'm not sure if this is the right group for this, but if not, please let me know where I should post my questions. I'm a novice to the world of jQuery and I've run into a snag (and can use some help). When I include the following line in my HTML file, the element doe not slide down as expected:
$(document).ready(function(){ $("#ContentHeader").slideDown(4000); });
When I load the page the element appears without sliding down. I'm self taught using CodeAcademy and a text titled: "JavaScript & jQuery: The Missing Manual". Do I have the syntax correct? Here is the full code I'm using:
<html lang="en">
<head><script> $(document).ready(function(){ $("#ContentHeader").slideDown(4000); }); </script>
</head>
<body>Andre Mitchell Stevens Swagger
Ain't it cool???
</body>
</html>======================= Every experience in life is a lesson to be learned A. Stevens B.S., Computer Science
You haven't posted your CSS, but the first thing I would check is that you have
display:none;
set for your#ContentHeader
element.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
You haven't posted your CSS, but the first thing I would check is that you have
display:none;
set for your#ContentHeader
element.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Richard, Thanks for your feedback. Unfortunately that did not work. If I include "display: none" (without the quotes) the element doesn't appear at all (and I also tried using "slow" as the parameter, rather than "4000"). I also tried:
$("#ContentHeader").hide().slideDown("slow");
but that didn't work either... Here is my CSS (so far):
h1, h2{
color: #FF8000;
text-align:center;
}#ContentHeader{
background-color: #000040;
border-color: #FF8000;
border-style:groove;
border-radius: 5pt;
border-width: 5pt;
/* display: none; */
}======================= Every experience in life is a lesson to be learned A. Stevens B.S., Computer Science
-
Greetings and Salutations! I'm not sure if this is the right group for this, but if not, please let me know where I should post my questions. I'm a novice to the world of jQuery and I've run into a snag (and can use some help). When I include the following line in my HTML file, the element doe not slide down as expected:
$(document).ready(function(){ $("#ContentHeader").slideDown(4000); });
When I load the page the element appears without sliding down. I'm self taught using CodeAcademy and a text titled: "JavaScript & jQuery: The Missing Manual". Do I have the syntax correct? Here is the full code I'm using:
<html lang="en">
<head><script> $(document).ready(function(){ $("#ContentHeader").slideDown(4000); }); </script>
</head>
<body>Andre Mitchell Stevens Swagger
Ain't it cool???
</body>
</html>======================= Every experience in life is a lesson to be learned A. Stevens B.S., Computer Science
If that is your complete page, then you haven't included the script tag to load jQuery itself. It should look something like this:
<script src="jquery.js"></script>
The actual
src=
filename and path may be different. -
Richard, Thanks for your feedback. Unfortunately that did not work. If I include "display: none" (without the quotes) the element doesn't appear at all (and I also tried using "slow" as the parameter, rather than "4000"). I also tried:
$("#ContentHeader").hide().slideDown("slow");
but that didn't work either... Here is my CSS (so far):
h1, h2{
color: #FF8000;
text-align:center;
}#ContentHeader{
background-color: #000040;
border-color: #FF8000;
border-style:groove;
border-radius: 5pt;
border-width: 5pt;
/* display: none; */
}======================= Every experience in life is a lesson to be learned A. Stevens B.S., Computer Science
You definitely need the
display:none;
. As Graham mentioned, you also need a<script>
tag to include jQuery. If you don't have a local copy, you can use a CDN - for example:<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
Here's a working example to play with: http://jsfiddle.net/Y5P7N/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer