One of the problems is that the Bootstrap slider JavaScript and CSS are not loaded unless a core multi-numeric-slider question exists on the page.
The easiest solution is to insert a multi-numeric-slider question directly after the array and then use JavaScript to:
- Remove the core array text inputs
- Hide the multi-numeric question
- Move the sliders from the multi-numeric question into the appropriate column of the array
This solution is far easier than inerting your own sliders or extending the array. The only downside is that you will have unused columns in the data (for the removed text inputs).
After inserting the multi-numeric-slider question, add this script to the question source of the array question:
Code:
<script type="text/javascript" data-author="Tony Partner">
$(document).on('ready pjax:scriptcomplete',function(){
// The column to receive the sliders
var sliderColumn = 3;
var thisQuestion = $('#question{QID}');
var nextQuestion = thisQuestion.nextAll('.numeric-multi:eq(0)');
// Hide the next question
nextQuestion.hide();
//Remove the core array text inputs
$('tr[id^="javatbd"] .answer-item:nth-child('+(sliderColumn+1)+') input', thisQuestion).remove();
// Wait for the sliders to be inititialized
$('input:text', nextQuestion).on('slideEnabled',function(){
var thisItem = $(this).closest('li');
var thisItemIndex = thisItem.index();
// Move the slider and add some styling
$('tr[id^="javatbd"]:eq('+thisItemIndex+') .answer-item:nth-child('+(sliderColumn+1)+')', thisQuestion).append($('.slider-container', thisItem));
$('tr[id^="javatbd"]:eq('+thisItemIndex+') .slider-container', thisQuestion)
.removeClass('col-xs-12 col-sm-12')
.css({
'display': 'block',
'padding': '25px 10px 0 10px'
});
});
});
</script>
Sample 5.x survey attached: