I've been trying to learn JavaScript and found a tutorial about making a mobile responsive header. I have every thing working except the javasript. I have tried linking the file, didn't work. I found out I needed jQuery to run scripts, so I linked that. And lastly I tried to include the actual script in the HTML code. Still not working
Here is the link to the tutorial, my desired result. http://jsfiddle.net/giobongio/DwrGK/2/
And here is my code is below, which is identical to the sample code. Please show me what I'm doing wrong.
HTML
<html>
<head>
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
// create smartbutton
$('nav').before('<div id="smartbutton"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
// add click listener
$('#smartbutton').click(function(event)
{
$('nav').animate({height:'toggle'},200);
});
</script>
<link rel="stylesheet" type="text/css" href="C:\Users\Anna\Desktop\Mobile Responsive\header.css">
</head>
<body>
<header>
<a id="logo" href="#"></a>
<nav>
<a href="#" class="navitem">Option 1</a>
<a href="#" class="navitem">Option 2</a>
<a href="#" class="navitem">Option 3</a>
</nav>
</header>
</body>
</html>
JavaScript
// create smartbutton
$('nav').before('<div id="smartbutton"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
// add click listener
$('#smartbutton').click(function(event)
{
$('nav').animate({height:'toggle'},200);
});
Thank you to all who helps, I've very appreciative. I am VERY NEW to JavaScript and I need some guidance.