Jump to content
Mysteriis

Scroll horizontal com bug no IE

Recommended Posts

Mysteriis

Boas,

Sou iniciante de jquery e estou a usar um script adaptado de vários que fui encontrando na net para animar um scroll horizontal.

No Chrone corre tudo bem, mas no FF e no IE tem um pequeno bug...parece que dá uns "soluços".... Deixo o link para poderem ver.... http://amplabusca.org/teste2/ementa.php.

O código javascript:

<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>

E nas CSS:

#next{
position: fixed;
z-index: 10;
top: 50%;
right: 20px;
}
#prev{
 position:fixed;
 visibility: hidden;
 top: 50%;
 left: 150px;
 z-index: 10;
}

Alguem faz ideia da origem deste bug???

Share this post


Link to post
Share on other sites
Mysteriis

Resolvido  :D

Mas deixo ficar a resolução para o caso de alguém precisar....

Eu estava a usar esta função para mover o scroll na horizontal:

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

Alteração:

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

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.