How do I get JQuery to work?
I am new to JQuery and I am trying to figure out how to get my .mouseenter() and .mouseleave() methods to work. So far I have tried using IE8 and FF, but for some strange reason I can not get my elements to do anything other than remaining static. Here's the code that I have so far:
HTML:
- <!Doctype html>
- <html>
- <head>
- <link type="text/css" rel="stylesheet" href="style.css"/>
- <script type="text/javascript" src="file:///D:/Documents%20and%20Settings/stsc/My%20Documents/_prac/script.js"></script>
- <title>Practice</title>
- </head>
- <body>
- <div id="red"></div>
- <div id="yellow"></div>
- <div id="green"></div>
- </body>
- </html>
CSS:
- div{
- height:100px;
- width: 100px;
- border-radius: 50px;
- }
- #red{
- background-color: red;
- }
- #yellow{
- background-color: yellow;
- }
- #green{
- background-color: green;
- }
JS:
- $(document).ready(function(){
- $('div').mouseenter(function(){
- $(this).animate({
- width: '+=10px'
- });
- });
- $('div').mouseleave(function(){
- $(this).animate({
- width: '-=10px'
- });
- });
- $('div').click(function() {
- $(this).toggle(1000);
- });
- });
This is just a simple example to practice using JQuery. Thanks in advance for the help guys!