Slider work from htm page but on php generated page only the "slide" event not work (start, stop, change ... work..)
Working page [html] ;-]
http://www.dataino.it/test/dataino_control.htm
Not working generated from php :-(( http://www.dataino.it/test/
i have included the jquery code
<script src="../shared/jquery/dataino.js" type="text/javascript"></script>
- $(document).ready(function() {
slidesize();
led();
});
//===============================================================
function slidesize() {
$(".ctrl").each(function() {
var sli = $("#slx", this);
var values = sli.text();
var value = values.split(';')[0];
var min = values.split(';')[1];
var max = values.split(';')[2];
var step = values.split(';')[3];
//=====================================
//alert(min + ' ! ' + max + ' ! ' + step + ' ! ' + value);
//=====================================
sli.empty().slider({
value: parseInt(value, 10),
min: parseInt(min, 10),
max: parseInt(max, 10),
step: parseInt(step, 10),
range: "min",
animate: true
});
//=====================================
//Store frequently elements in variables
//=====================================
var tooltip = $(".tooltip", this);
var volume = $(".volume", this);
var valore = $(".valore", this);
//=====================================
//Hide the Tooltip at first
//=====================================
tooltip.hide();
//=====================================
//Call the Slider
//=====================================
sli.slider({
//=====================================
start: function(event,ui) {tooltip.fadeIn('fast');},
//=====================================
//Slider Event //When the slider is sliding
//=====================================
slide: function(event, ui) {
slih = $(this).children('.ui-slider-handle').position();
var position = slih.left;
tooltip.text(sli.slider('value')).css({ 'left': slih.left - ( tooltip.width()/2)+145 });
//%r = (Parte slider x 100)/ valore slider
var valunsigned = sli.slider('value') - (min);
var valmax = max - (min);
var perc = (valunsigned * 100) / valmax ;
if( perc <= 5) {
volume.css('background-position', '0 0');
}
else if (perc <= 25) {
volume.css('background-position', '0 -25px');
}
else if (perc <= 75) {
volume.css('background-position', '0 -50px');
}
else {
volume.css('background-position', '0 -75px');
};
},
//=====================================
//stop Event
//=====================================
stop: function(event,ui) {
tooltip.fadeOut('fast');
valore.val(sli.slider('value'));
//$("#formina").submit();
},
});
});
}
//===============================================================
//===============================================================
function led() {
$(".ctrl").each(function() {
var led = $("#led", this);
var valbit = $(".hx", this);
var value= valbit.val()
if (value>=0) {
//led.bind("click", function() {
led.click(function(event){
if (value == 0) {
//alert(value);
led.attr('src', '../img/led_on.png');
valbit.attr('value', '1');
//$("#formina").submit();
}
else {
//alert(value);
led.attr('src', '../img/led_off.png');
valbit.attr('value', '0');
//$("#formina").submit();
}
});
};
});
}
thx