I'm trying to do a simple .fadeIn() ONCE for the first div, but the problem is that this is an Ajax load inside a everyTime(xxx sec), so it does the same thing everytime it loads again.
How can I prevent the first div to .fadeIn() over and over again, but still do this function on the new div?
I am not very familiar with jQuery, so feed me with a spoon :)
Update:
I have been trying out all of your suggestions! I really appreciate your help, but I'm still stuck. I haven't got the .one to work. I tried $("#chatline:first").one(function(){ $(this).fadein()});, but I get a major failure from jQuery :p as I said. I'm pretty new to jQuery.
I also tried adding and removing classes, but cannot make jQuery remember that the class is removed, so it fades in and out, etc.
Here's the script, sligtly shorted.
...
j(document).ready(function(){ //reloads every 3sec j(".chatref").everyTime(3000,function(i){ j.ajax({url: "chatx.php", cache: false, success: function(html){ j(".chatref").html(html); // These for testing if($('div#chatline').hasClass('first')){ j("#chatline").fadeIn('slow'); } snipped... End of jQuery
PHP (part of chatx.php):
div class='chatref' <- This one is only for jQuery's everytime function, e.g where to show the stuff. Don't know other ways to do this. //First div I added classname first and hidden with PHP. div class='chatline hidden first' div class='chatline' div class='chatline' div class='chatline' .... etc. snipped... End PHP.
I hope I have explained it good enough! Thanx for the help guys!!