- Posts: 12
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
#question46926 label.slider-label { padding-top: 50px; padding-right: 50px; } #question46926 div.multinum-slider { margin: 80px 20px 0 20px; }
tpartner wrote: Okay, now that I've woken up and re-read the thread, I think I understand - you're only concerned about clicking the slider bar, not dragging the handle.
Add the following to the end of template.css to convert the slider handle to a vertical bar and hide the slider callout (these styles are for the default template). Replace "QQ" with your question ID.Code:#questionQQ .ui-slider .ui-slider-handle { height:25px; width: 2px; margin-left: 0; top: -8px; background: #79B7E7 none; border: 0 none; } #questionQQ .slider_callout { display: none; }
If you want to initially hide the slider handle, set up your survey to use JavaScript and add the following script to the source of the slider question. Again, replace "QQ" with the question ID.Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = QQ; $('#question'+qID+' .ui-slider .ui-slider-handle').hide(); $('#question'+qID+' .ui-slider').live('mouseup', function() { $('#question'+qID+' .ui-slider .ui-slider-handle').show(); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#question{QID} .question-item').hide(); $('#question{QID} input[type="text"]').each(function(i) { $('#question{QID} input[type="text"]').on('slideEnabled', function(e) { var thisRow = $(this).closest('.question-item'); $('.slider .tooltip', thisRow).addClass('hidden'); $('.slider .slider-handle', thisRow).hide(); $('.slider', thisRow).on('slideStop', function(e) { $('.slider-handle', thisRow).show(); }); $(thisRow).show(); }); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#question{QID} .question-item').hide(); $('#question{QID} input[type="text"]').each(function(i) { $('#question{QID} input[type="text"]').on('slideEnabled', function(e) { var thisRow = $(this).closest('.question-item'); $('.slider .tooltip', thisRow).addClass('hidden'); $('.slider .slider-handle', thisRow).hide(); $('.slider', thisRow).on('slideStop', function(e) { $('.slider-handle', thisRow).show(); }); $(thisRow).show(); }); }); }); </script>
.slider .tooltip.top { display:none; }
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var qID = {QID}; var thisQuestion = $('#question'+qID); $('input:text', thisQuestion).on('slideEnabled',function(){ var thisItem = $(this).closest('li'); var thisCode = $(thisItem).attr('id').split('X'+qID)[1]; // Remove the tooltips $('.tooltip', thisItem).remove(); // Initially hide the slider handle if($('input:text[id^="answer"][id$="X'+qID+thisCode+'"]', thisItem).val() == '') { $('.slider-handle', thisItem).hide(); } // Listener on slider $(this).on('slide slideStop', function(event) { // Show the slider handle $('.slider-handle', thisItem).show(); }); }); }); </script>