I have a first.js file included in the page index.php that have something like this:
$(function(){
$("#my_slider").slider("value", 10);
});
And them in index.php I have some dynamicly created slidders:
<?php function slidders($config, $addon)
{
$return = '
<script type="text/javascript">
$(function() {
$("#slider_'.$addon['p_cod'].'").slider({
min: '.$config['min'].',
max: '.$config['max'].',
step: '.$config['step'].',
slide: function(event, ui) {
$("#cod_'.$addon['p_cod'].'").val(ui.value);
$(".cod_'.$addon['p_cod'].'").html(ui.value+"'.@$unit.'");
},
change: function(event, ui) {
$("#cod_'.$addon['p_cod'].'").change();
}
});
$("#cod_'.$addon['p_cod'].'").val($("#slider_'.$addon['p_cod'].'").slider("value"));
$(".cod_'.$addon['p_cod'].'").html($("#slider_'.$addon['p_cod'].'").slider("value")+"'.@$unit.'");
});
</script>';
return $return;
} ?>
The problem is, because my index.php sliders are being instantiated after my first.js I can't set up a value there, is there any event like "after all $(document).ready() have run" that I can use in first.js to manipulate the sliders created in index.php?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…