1

I use jquery to load and fade in content in a target div. This works great and i love how neat it looks. However if you click a link to fade in the content several times (fast) the content doesent seem to progress to full opacity. So if i press the link twice (again quite fast) it only reaches like 50% transparancy. Why is this? Can i put like another code wich guarantees this? This is my code:

$(".nav").click(function(e){
        e.preventDefault();

        $('#target').html('Loading...');

        $.get(this.href, function(data) {

            $("#target").hide(0, function(){
                $(this).html(data).fadeIn("fast");
            });

        }); 
});
Paparappa
  • 2,099
  • 3
  • 18
  • 35

1 Answers1

4

try to add .stop(true,true)

$(".nav").click(function(e){
        e.preventDefault();

        $('#target').html('Loading...');

        $.get(this.href, function(data) {

            $("#target").hide(0, function(){
                $(this).html(data).stop(true,true).fadeIn("fast");
            });

        }); 
});
Qchmqs
  • 1,803
  • 2
  • 20
  • 29