http://wowjava.wordpress.com/2010/02/06/auto-refreshing-the-content-without-reloading-page-using-jquery/
integrating a better comments system like this would be cool
http://www.commentics.org/
Newsfeed is loaded in div feed1, but i don't know how load only it.
I tried find the solution, but I don't had sucess.
Will someone contact me when a newfeed refresh can be used here. I have a site that has live events and we all have to refresh manually to see the next ones post in a group. I want it to work like chat does so those of us that forget to refresh don't miss anything. Please let me know?
This woks fine:
<script src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script>var auto_refresh = setInterval(
function()
{
$('#feed1').fadeOut('slow').load('reload.php').fadeIn("slow");
}, 20000);
</script>
Hi S.Williams
I have now:
<script>var auto_refresh = setInterval(
function()
{
$('#feed1').fadeOut('slow').load(location.href="/index").fadeIn("slow");
}, 20000);
</script>
But newsfeeds reload first 1 sec after the whole index page.
When i have:
<script>var auto_refresh = setInterval(
function()
{
$('#feed1').fadeOut('slow').load('reload.php').fadeIn("slow");
}, 20000);
</script>
Then reload only the newsfeed.
I have this in the HTML widget:
<script>var time = new Date().getTime();
var refreshTime = 20*1000;
$(document).bind("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error hover change", function(e) {
time = new Date().getTime(); });
function refresh()
{
if(new Date().getTime() - time >= refreshTime)
$('#feed1').fadeOut('slow').load('reload.php').fadeIn("slow");
else
setTimeout(refresh, refreshTime);
}
setTimeout(refresh, refreshTime);
</script>
That works when i ('reload.php') replace with (location.href="/index") then refresh the whole index page
Maby my theme?
<script>
var time = new Date().getTime();
var refreshTime = 20*1000;
$(document).bind("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error hover change", function(e) {
time = new Date().getTime();
});
var previousScrollPos = localStorage.getItem("lastScrollPos");
if(previousScrollPos)
{
$('#feed1').scrollTop(previousScrollPos);
localStorage.removeItem("lastScrollPos");
}
function refresh() {
if(new Date().getTime() - time >= refreshTime)
{
localStorage.setItem("lastScrollPos", $('#feed1').scrollTop());
location.reload();
}
}
setInterval(refresh, refreshTime);
</script>
in a custom widget and placed it under my news feed it just refreshes the whole page
I did not read all your posts, but AFAIK The newsfeed feature you want is a hard and risky task to complete.(if it wasn't there would be plugin in store until now !)it's not possible only with client side changes, or if you could get this done,It will not function properly(as u pictured it)
there are just lots of details
Don't waste your time at this since not worth it
<script>
var time = new Date().getTime();
var refreshTime = 6*1000;
$(document).bind("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error hover change", function(e) {
time = new Date().getTime(); });
function refresh()
{
if(new Date().getTime() - time >= refreshTime)
window.location.reload(true);
else
setTimeout(refresh, refreshTime);
}
setTimeout(refresh, refreshTime);
</script>