Move div with Jquery

I use this script to create a simple horizontal animate scroll. But i need move div #logo with the body…

I try


but don´t work…

$(document).ready(function() {
 var margin = 0;
 var width  = $('body').width();

   $('#next').click(function(event) {
	margin +=width;
        $('html, body').stop().animate({scrollLeft:"+="+500},1000);
		$("#prev a").css('visibility','visible');
    $('#prev').click(function(event) {
	margin -=width;
        $('html, body').stop().animate({scrollLeft:"-="+500},1000);
	if(margin<100){$("#prev a").css('visibility','hidden');}

Anyone can help me??

a wild guess but i think this line:


should be written as:


I tried $(‘#logo’).animate({left:“+=500”},1000); but did not work

with this html code i am able to animate the #logo div…

make sure you are including the jquery code, and i think you also
need to specify the #logo div as position:relative or position:absolute before
jquery would be able to move the element.

hope this helps

<!DOCTYPE html>
<style type="text/css">
#logo {
[COLOR="Blue"]position: relative;[/COLOR]
<div id="logo">logo</div>

<script src=""></script>

you are right, the code work. The div #logo was float:left, changing to position:relative the code works…

Thanks :slight_smile:

no prob, glad i could be of assistance.