Modifying scroller.js

Hi all,

I’ve been looking at scroller.js to see if I could find a way to cause the scroll to pause for a few seconds when the mouse is clicked. I can see what the script does, but my expertise in javascript is pretty low. What appears to be needed is to add an onclick event, but I don’t understand javascript well enough to see where that might need to be, or what the code would look like.

Can anyone point me in the right direction for this?

Thanks,

Andy

Hi Andy,

write a function called pause (say) then at the bottom of the script add window.onclick=pause; as to what’s in pause - maybe just a toggle? if (timeout) == 500 timeout=50000 else timeout = 500; but you’d need to click again to get the prig speed back.

···

On Wed, Mar 11, 2015 at 5:09 PM, andy@sailor.nu [sailwave] sailwave@yahoogroups.com wrote:

Hi all,

I’ve been looking at scroller.js to see if I could find a way to cause the scroll to pause for a few seconds when the mouse is clicked. I can see what the script does, but my expertise in javascript is pretty low. What appears to be needed is to add an onclick event, but I don’t understand javascript well enough to see where that might need to be, or what the code would look like.

Can anyone point me in the right direction for this?

Thanks,

Andy

Andy javascript is not my baby but does this fairly basic bit of code help?

<html>
<head>
<script type="text/javascript">
window.onclick = function() {alert('test');}
</script>
</head>
<body >
Your results are scrolling nicely here...
</body>
</html>

Not familliar enough with the scroller code but I think javascript is asyncronous so this pop-up would appear independnatly of the scroller so simply sleeping for X seconds will not stop the scroller - but I could be wrong. If I'm right you may need to define a global variable that gets switched to say sleep until its switched off - but that does mean messing in the scroller.js code - there may be a better (cleaner) way.

Final thing to remember is that if someone is actually clicking a link this will still generate the onClick event for window so if your pause is too long may mean the link isn't followed. The person then clicks it again regenerating the pause etc etc...

Calum

How will you differentiate

···

On 11 Mar 2015 10:09:54 -0700 "andy@sailor.nu [sailwave]" <sailwave@yahoogroups.com> wrote:

Hi all,
I've been looking at scroller.js to see if I could find a way to cause the scroll to pause for a few seconds when the mouse is clicked. I can see what the script does, but my expertise in javascript is pretty low. What appears to be needed is to add an onclick event, but I don't understand javascript well enough to see where that might need to be, or what the code would look like.

Can anyone point me in the right direction for this?

Thanks,
Andy

--
Calum Polwart <yahoo@wittongilbert.free-online.co.uk>