Alternative to animate({marginLeft
Hi,
I have a number of list items that are populated with news stories and I want the user to be able to scroll left and right through the news stories. Scrolling left works fine with the following code:
Note .prev is the class for left button
- $('.prev').click(function(){
- $('li.rssRow:first').animate( {marginLeft: '-300px'}, 1000, function()
- {
- $('li.rssRow:first').detach().appendTo('.rssBody ul').removeAttr('style');
- });
- });
The first item in the list scrolls off the screen and is detached from the list to be appended to the end of the list.
When I try to scroll right and use
- $(this).animate({marginLeft: '300px'} , 1000);
the item moves across the screen but leaves a blank margin of 300 pixels to the left of it.
I don't want this margin, I want to animate something else into this position.
Is there an alternative to marginLeft for animating an item from left to tight?
Mark