hey guys. i have the following code which works. The code automatically updates a div every X seconds. Im new to usig Javascript so really struggling with what im trying to achieve. Basically the code works but the fade fuction is not doing what i want. I only want the fadein to apply to new posts in the div.
eg. if div displays '1, 2" i want "1, 2" to fade in, but when i update the div again i only want NEW data to fade in, rather than the entire div. So if i enter "3" in to the div, "3" fades in, not "1,2,3". Basically im looking for something similar to the bbc ajax script.
Code:<html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script language="javascript"> function getRefresh() { $("#auto").fadeIn("slow"); $("#auto").load("ajax.php", callback); } function callback() { $("#auto").fadeOut("slow"); setTimeout("getRefresh();", 1000); } $(document).ready(getRefresh); </script> </head> <body> <div id="auto"> Random text goes here </div> </body> </html>


Reply With Quote



Bookmarks