is it possible to animate a html5 video element
<div id="cont">
<video id="movie" width="320" height="240" preload controls>
<source src="pr6.ogv" type='video/ogg; codecs="theora, vorbis"'>
<source src="pr6.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="pr6.webm" type='video/webm; codecs="vp8, vorbis"'>
</video>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#cont').animate({"left": "500px"}, "fast");
//$('#movie').css("left", "300px");
});
</script>
This seems not to work!
leftwill have no meaning unless it has a position other thanstatic(the default). Give it aposition: relativecss attribute first, like this:You can see a quick demo here
Alternatively, and even better, give the
<div>,<video>, whatever you want to animate, this attribute in the stylesheet (either via the ID or a class), like this:In the second approach you’d add a
class="relative"to the element you’re animating. With this approach, your current code works, so choose a method, stylesheet or.css(), either works.