Reputation: 439
This is my code:
<html>
<head>
<script type="text/javascript" src="E:\Priya\Animation\Horse Animation\js\jquery-1.4.2.min.js"></script>
<script>
$(document).ready(function(){
alert('welcome');
$("#lion").animate({left: '250px'});
});
</script>
</head>
<body>
<div id="lion" style="width:213px; height:295px; background:yellow;"></div>
</body>
</html>
I don't know where the code went wrong. alert is working but animate is not working.
Upvotes: 0
Views: 208
Reputation: 17366
Neither there is a script issue nor a permission issue
Add Position:absolute;
to your parent div
, i mean main div
The default positioning for all elements is Position:static
, which means the element is not positioned and occurs where it normally would in the document.
Because left,top,right,bottom
positioning will work with position:absolute
so you are missing that one.
Upvotes: 2
Reputation: 4056
Try This
<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
Instead Of this
<script type="text/javascript" src="E:\Priya\Animation\Horse Animation\js\jquery-1.4.2.min.js"></script>
Maybe your js file not working
Upvotes: 1
Reputation: 103368
The element needs to be set with position:absolute
if you are to use left
:
<div id="lion" style="width:213px; height:295px; background:yellow;position:absolute;"></div>
Upvotes: 6