0

hi everyone...

i have tried creating an auto updater that will reload a certain div just like on facebooks status/wall refresher, when a user moves the mouse it auto refreshes there wall.

so far i have the code below...but the problem is its just executing my function over and over again. ive tried mouseout/over/hover/move but they all just keep reloading the function forever

<script>
var thewallurl = "<?php echo current_url(); ?> #main-wallinfo";
function loadcomms()
{
$('#main-wallinfo').fadeOut('slow').load(thewallurl).fadeIn("slow");
};
</script>

then i call it here

  <div id="main-wallinfo" onmousemove="javascript:loadcomms()">

any help is greatly appreciated
thanks

4
Contributors
9
Replies
11
Views
4 Years
Discussion Span
Last Post by shlokka
0

onmousemove="javascript:loadcomms()

this is causing repeat execution, so remove this.
when u move mouse over div it will execute.
you want to call it once, then just at the end of page write this lines

<script lang='javascript'>
    loadcomms();
</script>
0

hi, thanks,its now stopped refreshing for infinity...but i need it to execute when ever the mouse goes over the div, is there a way i can integrate some mouse over with the way you suggested calling the function?

thanks

0

You may want to use the onmouseover and onmouseout events instead of onmousemove for this scenario.

0

but i removed the mouseover/move as you requested. so its no longer there

0

this may run only once when u brink mouse pointer on the div and not multiple time as it was in case of mousemove

<div id="main-wallinfo" onmouseover="javascript:loadcomms()">
0

its doing the same thing

if i quickly hover the div it seems to execute 9 times
if i hold it on the div it never ends

0

just to let u kno its solved...

it appears you cannot call the same div id that your fading out, or maybe its you need to call inside the starting div??

anyway...i added a new div and entered that id into the url var instead of #main-wallinfo i have #wallinfobox

it now works perfect

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.