lod3
Junior Member
Posts: 2
Registered: 4/17/2008
Location: ireland
Member Is Offline
|
| posted on 4/17/2008 at 12:09 AM |
|
|
Calling a function when the slider updates.
Hi, I'd really appreciate if anyone can tell me a solution to this problem.
I have five sliders and five of my own javascript functions.
What I want is for slider one to trigger function one, slider two to trigger function two and so on.
I tried just putting an onchange="function()" in the correct text fields - but this only registers an event when a user actually types something
into the field.
thanks!
|
|
|
lod3
Junior Member
Posts: 2
Registered: 4/17/2008
Location: ireland
Member Is Offline
|
| posted on 4/17/2008 at 12:43 AM |
|
|
I found a solution,
I couldn't get the slider itself to register an event, so I wrapped the slider in a div ( <div id="float"> slider code here </div>
)
And I then attached an eventlistener to the div in question.
document.getElementById('float').addEventListener('click',everything,false);
Which means every time someone clicks inside the 'float' div (which contains a slider) then a mouse click event will be registered which calls the
function everything() - written like so : ('click',everything,false)
butttt
This doesnt work in IE
Using the same method above of wrapping the slider code in a div, simply put onmouseup="function()" when declaring the div:
<div id="float" onmouseup="function()"> slider code </div>
So function() will be called everytime someone clicks on the slider (regardless of if they change the value)
This method appears to work both in firefox and ie.
Hope it helps someone else
|
|
|