Animate scrollLeft get problems in IE and FF
I´m trying animate horizontal scroll. I use this code:
- <script type="text/javascript" src="jquery-1.5.2.min.js" ></script>
- <script type="text/javascript">
- $(document).ready(function() {
- var margin = 0;
- var width = $('body').width();
-
- $('#next').click(function() {
- margin +=width;
- $('html, body').stop().animate({scrollLeft:"+="+500},1000);
- $("#prev a").css('visibility','visible');
- });
- $('#prev').click(function() {
- margin -=width;
- $('html, body').stop().animate({scrollLeft:"-="+500},1000);
- if(margin<200){$("#prev a").css('visibility','hidden');}
- });
- });
- </script>
In firefox and IE, gets a little bug whin click to scroll, like a ghost of previous divs. This hard trying explain, see the example: