In my code below, I want to change the initial value with a slider. The slider works and everything, but it's not changing the values of the timeout
, shown under the $('ul.<?php echo $this->session->userdata('username'); ?>').innerfade({
line.
The value of slider
in the line $('#ex1').on('slide', function(slider)
is equal to the value of the input-form attribute data-slider-value
which is 100.
Now, when I start to adjust the input slider, it will change the attribute from its initial value of 100 to whatever the user slides to.
But the problem is, the slider won't change the values inside the jquery code...
So to make it more clear:
In the JS code, the variable 'value' is declared, but not yet initialized to a value.
The variable 'value' is then assigned to 'slider.value'
And so the logical conclusion is that the 'timeout' variable should change dynamically, according to the values inputted by the slider.
<!-- Start slider -->
<p>
<input id="ex1" data-slider-id='ex1Slider' type="text" data-slider-min="1" data-slider-max="1000" data-slider-step="1" data-slider-value="100"/>
</p>
<script type="text/javascript">
$(document).ready(
function(){
var value;
$('#ex1').slider();
$('#ex1').on('slide', function(slider)
{
value = slider.value;
});
$('ul.<?php echo $this->session->userdata('username'); ?>').innerfade({
speed: 0,
timeout: value,
type: 'sequence',
containerheight: '480px'
});
});
</script>