I use this script to create a simple horizontal animate scroll. But i need move div #logo with the body…
I try
$('#logo').animate({left:"+="+500},1000);
but don´t work…
$(document).ready(function() {
var margin = 0;
var width = $('body').width();
$('#next').click(function(event) {
event.preventDefault();
margin +=width;
$('html, body').stop().animate({scrollLeft:"+="+500},1000);
$("#prev a").css('visibility','visible');
});
$('#prev').click(function(event) {
event.preventDefault();
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:
$(‘#logo’).animate({left:“+=”+500},1000);
should be written as:
$(‘#logo’).animate({left:“+=500”},1000);
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>
<head>
<style type="text/css">
#logo {
[COLOR="Blue"]position: relative;[/COLOR]
}
</style>
</head>
<body>
<div id="logo">logo</div>
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script>
$(document).ready(function(){
$('#logo').animate([COLOR="Blue"]{left:"+=500"}[/COLOR],1000);
});
</script>
</body>
</html>
you are right, the code work. The div #logo was float:left, changing to position:relative the code works…
Thanks 
no prob, glad i could be of assistance.