Welcome to the LimeSurvey Community Forum

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

Slider Issue

  • StefanBasen
  • StefanBasen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #154868 by StefanBasen
Slider Issue was created by StefanBasen
Hi everyone!
I found a script for two Sliders here in this Forum:
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).ready(function() {
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    $('select', thisQuestion).each(function(i, el){
 
      // Identify some elements
      var thisSelect = $(this);
      var thisCell = $(thisSelect).closest('td.question-item');
      var thisRow = $(thisSelect).closest('tr.subquestions-list');
      var otherCell = $(thisRow).find('td.question-item').not(thisCell);
      var otherSelect = $('select', otherCell);
 
      // Hide the dropdown
      $(thisSelect).hide();
 
      // Some dropdown values
      var currentVal = Number($('option:selected', thisSelect).val());
      var firstVal = Number($('option[value!=""]:first', thisSelect).val());
      var secondVal = Number($('option[value!=""]:first', thisSelect).next('option').val());
      var lastVal = Number($('option[value!=""]:last', thisSelect).val());
 
      // Insert a container for the slider
      var container = $('<div class="customSliderWrapper"></div>').insertAfter(thisSelect);
 
      // Initiate the slider
      var thisSlider = $('<div class="customSlider"></div>').appendTo(container).slider({
        min: firstVal,
        max: lastVal,
        range: 'min',
        value: currentVal,
        step: secondVal - firstVal,
        slide: function( event, ui ) {
          // Load the value for this slider
          $(thisSelect).val(ui.value);
          $('input:hidden', thisCell).attr('value', $(thisSelect).val());
          $('.slider-callout', thisCell).text($(thisSelect).val());
 
 
        }
      });
 
      // Insert a callout
      var callout = $('<div class="slider_callout slider-callout"></div>').appendTo($('.ui-slider-handle', thisCell)).text($('option:selected', el).val());
 
      // Set a value as soon as the slider handle is clicked
      $('.ui-slider-handle', thisCell).mousedown(function() {
        // Load the value for this slider
        $(thisSelect).val(thisSlider.slider('value'));
        $('input:hidden', thisCell).attr('value', $(thisSelect).val());
        $('.slider-callout', thisCell).text($(thisSelect).val());
 
 
      });
    });
  });
</script>

The Sliders work pretty well but as you can see at the screenshots the sliders are very close to each other.
Is there a way to seperate the both sliders more from those on the right side? Just a little gab or maybe a colour change?

Thank you for your time and help :)
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #154871 by tpartner
Replied by tpartner on topic Slider Issue
We have no idea what LimeSurvey version or template you are using so cannot answer that without seeing a live test survey.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • StefanBasen
  • StefanBasen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #154872 by StefanBasen
Replied by StefanBasen on topic Slider Issue
Hi tpartner and thanks for your answer.
So the Version is: Version 2.06+ Build 150619 and im using the basic template.
For a live test, do you need the link to the survey or what do you need?

Thank you!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #154874 by tpartner
Replied by tpartner on topic Slider Issue
Yes, a link to an activated test survey.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
6 years 10 months ago - 6 years 10 months ago #154878 by Ben_V
Replied by Ben_V on topic Slider Issue

StefanBasen wrote: Version 2.06+ Build 150619...


I warmly recommand you to update your installation to the last 2.06+ version (renamed 2.6):

github.com/LimeSurvey/LimeSurvey/tree/2.06lts

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 6 years 10 months ago by Ben_V.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #154904 by tpartner
Replied by tpartner on topic Slider Issue
Stefan, I got your PM but I don't have time to go through an extensive survey to get to the screen with the sliders. I'm happy to look at it if you create a test survey containing only the offending question(s).

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago - 6 years 10 months ago #154941 by tpartner
Replied by tpartner on topic Slider Issue
Try adding this to the end of template.css:

Code:
.customSliderWrapper {
    margin: 30px auto 15px;
    width: 90%;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 10 months ago by tpartner.
The topic has been locked.
  • StefanBasen
  • StefanBasen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #154944 by StefanBasen
Replied by StefanBasen on topic Slider Issue
Sadly that code did nothing :(
The Sliders are still very close together
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #154945 by tpartner
Replied by tpartner on topic Slider Issue
I don't see it added in the template.css file used by the demo survey.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago - 6 years 10 months ago #154947 by tpartner
Replied by tpartner on topic Slider Issue
Ah, there you go.



Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 10 months ago by tpartner.
The topic has been locked.
  • StefanBasen
  • StefanBasen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #154948 by StefanBasen
Replied by StefanBasen on topic Slider Issue
Well what can i say? Thank you tpartner for this awesome support.
Found out that my used template ( which was a copy from the basic template) had some hicups. So i recopied the template and everything,added the code to the template.css and yeah: it works!

Thank you so much!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose