Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Fade in only NEW entries
Old 09-28-2008, 09:11 PM Fade in only NEW entries
Galaxian's Avatar
Dingleberry!

Posts: 825
Name: Rich
Location: United Kingdom
Trades: 0
So I was watching the BBC streaming broadcast of the obama mccain live debate and they had live commentary using what i presume was ajax.

The new commentary entries faded in and animated nicely on top of the others.

How would one achieve this one?

Notably using jquery.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Galaxian is offline
Reply With Quote
View Public Profile Visit Galaxian's homepage!
 
 
Register now for full access!
Old 09-29-2008, 02:03 PM Re: Fade in only NEW entries
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
The most important thing to note, is that your script won't be able to receive messages, it can only check for the existence of new information on a regular basis. Therefore, to load the "commentary", or whatever you want to load on an incremental basis, will have to be checked for regularly with the setInterval method:

Code:
$(document).ready(function() {
var intervalId=setInterval(function() {
    $("#commentary").load("commentary.php"); //load remote content into the #commentary div
}, 2000); //checks every 2 seconds for content
});
You could get a bit fancier, and check to see if the new data matches the old data, then only loading it if it doesn't, but if you are only loading a small amount of data, this shouldn't matter too much.

You may also want a way to end the setInterval loop, so it will stop checking for new content if it receives content like END OF COMMENTARY, or something like that. To end the loop you would say clearInterval(intervalId);

Of course, fading or animating is a different matter, but that is easy enough to manage with jQuery.
__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 09-29-2008 at 02:05 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Fade in only NEW entries
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.56611 seconds with 12 queries