Hi,
im Rangeslider Template habe ich u.a. snap und numstep angepasst, um den Slider zu rastern. Beim Knob-left funktionierts auch, nur der knob-right rastert nicht. Woran mag das liegen ?
HTML-Code:
....
$intMin = current($arrOptions);
$intMin = round($intMin, -1, PHP_ROUND_HALF_ODD);
$intMin = ($intMin > 0) ? ($intMin - 10) : $intMin;
$intMin = ($intMin == 0) ? 0 : $intMin;
// Max.
$intMax = array_pop($arrOptions);
$intMax = round($intMax, -1, PHP_ROUND_HALF_UP);
$intMax = ($intMax + 0);
// Current values.
$arrCurrentMin = ($this->raw['value'][0] == null) ? $intMin : $this->raw['value'][0];
$arrCurrentMax = ($this->raw['value'][1] == null) ? $intMax : $this->raw['value'][1];
...
<script type="text/javascript">
// ON LOAD
window.addEvent('domready', function ()
{
var firstRun<?php echo $strInputId; ?> = true;
new Slider($('slider_minmax_gutter_m'), $('slider_minmax_minKnobA'), $('slider_bkg_img'), {
//start: <?php echo intval($intMin); ?>,
//end: <?php echo intval($intMax); ?>,
start: 0,
end: 5000000,
offset: 0,
snap: true,
numsteps:5,
onChange: function (pos)
{
$('slider_minmax_min').set('text', 'ab ' + pos.minpos + ' €');
$('slider_minmax_max').set('text', 'bis ' + pos.maxpos + ' €');
if(pos.minpos != <?php echo intval($intMin); ?> || pos.maxpos != <?php echo intval($intMax); ?>)
{
$('ctrl_<?php echo $strInputId; ?>_0').set('value', pos.minpos);
$('ctrl_<?php echo $strInputId; ?>_1').set('value', pos.maxpos);
}
else
{
$('ctrl_<?php echo $strInputId; ?>_0').set('value', '');
$('ctrl_<?php echo $strInputId; ?>_1').set('value', '');
}
},
onComplete: function (pos)
{
if(firstRun<?php echo $strInputId; ?> == true)
{
return;
}
$('slider_minmax_min').set('text', 'ab ' + pos.minpos + ' €');
$('slider_minmax_max').set('text', 'bis ' + pos.maxpos + ' €');
if(pos.minpos != <?php echo intval($intMin); ?> || pos.maxpos != <?php echo intval($intMax); ?>)
{
$('ctrl_<?php echo $strInputId; ?>_0').set('value', pos.minpos);
$('ctrl_<?php echo $strInputId; ?>_1').set('value', pos.maxpos);
}
else
{
$('ctrl_<?php echo $strInputId; ?>_0').set('value', '');
$('ctrl_<?php echo $strInputId; ?>_1').set('value', '');
}
if(pos.minpos != <?php echo intval($arrCurrentMin); ?> || pos.maxpos != <?php echo intval($arrCurrentMax); ?>)
{
var parent = $('ctrl_<?php echo $strInputId; ?>_0').getParent('form');
parent.submit();
}
}
}, $('slider_minmax_maxKnobA')).setMin(<?php echo intval($arrCurrentMin); ?>).setMax(<?php echo intval($arrCurrentMax); ?>);
firstRun<?php echo $strInputId; ?> = false;
});
</script>
.....
Lesezeichen