Welcome to Gaia! ::

I made a JQuery Script that loads a chat page for new post every 3 seconds, and I decided to make it accommodate the fact that people might want to read previous post.
So, I made buttons to Start and Stop the chat area scroll bar, but the darn thing wont budge. gonk

$(window).load(function() {
var auto_refresh = setInterval(function () {
$('#chat-wrap').load('lounge.php').fadeIn('slow')
}, 3000)
})

function pageScroll() {
document.getElementById('chat-area').scrollBy(0,50)
scrolldelay = setTimeout('pageScroll()',100)
}

function stopScroll() {
clearTimeout(scrolldelay)
}
load() is an event handler. It expects a function that will get called when the associated element is done loading.

If you want to load the response of a request, you'll need to append it yourself:
window.setInterval(function() {
$.get('lounge.php', {}, function(data) {
$('#chat-wrap').append(data).fadeIn('slow') ;
}, 'html') ;
}, 3000) ;
From what I understand you want to set an auto refresher when page is fully loaded. Here is the code to do so:


$(window).ready(function() {
var auto_refresh = setInterval(function () {
$('#chat-wrap').load('lounge.php').fadeIn('slow')
}, 3000)
})

function pageScroll() {
document.getElementById('chat-area').scrollBy(0,50)
scrolldelay = setTimeout('pageScroll()',100)
}

function stopScroll() {
clearTimeout(scrolldelay)
}

Quick Reply

Submit
Manage Your Items
Other Stuff
Get Items
Get Gaia Cash
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff