Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

I want to hide the slider handle by default until the user click on slider.

  • ErtanErsan
  • ErtanErsan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 6 months ago #189441 by ErtanErsan
I want to hide the slider handle by default until the user click on slider. I found some script but doesn't work on Limesurvey 3.0.


This is the script i found:

<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

$('.ui-slider-handle').hide();

$('.ui-slider').mousedown(function(){
$('.ui-slider-handle', this).show();
});
});

</script>

Any help?
Thank you
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #189475 by tpartner
Disable AJAX in the question theme options and add a script like this to the source of the question:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    $('input:text', thisQuestion).on('slideEnabled',function(){ 
      var thisItem = $(this).closest('li');
      var thisSlider = $('.slider', thisItem);
      var answerInput = $('input:text.form-control', thisItem).not('[id$="slid"]'); 
 
      // Hide the tooltip if no value for the slider
      if($(answerInput).val() == '') {
         $('.tooltip', thisSlider).hide();
      }
 
      // Listener on slider
      $(this).on('slide slideStop', function(event) {
        $('.tooltip', thisSlider).show();
      });
    });
    });
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...0-03.lss
File Size:34 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • ErtanErsan
  • ErtanErsan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 6 months ago #189570 by ErtanErsan
Hi tpartner,

Thank you for your unswer. This works perfect :)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose