- Posts: 14
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
.slider-selection{background: transparent; background-image:none}
// This function stylizes sliders on the page and registers the "slideStart" event // The defualt choice for all sliders in this theme is to set the tooltip to a value of // "Please Select" and hide the selection bar until an initial value has been selected. function stylizeSlider() { // Create an object containing all the sliders on the page var sliders = window.activeSliders; // Since we might be dealing with multiple sliders on a page, we are defining a separate funtion // to properly handle variable scoping for each slider. var myFunc = function (slider) { // Initialize a boolean to track whether the slider has been manipulated var slideStarted = false; // Get the div of slider selection (so we can hide/show) var sliderSelection = $(slider.getElement()).find(".slider-track .slider-selection"); // Hide the slider selction on the initial rendering of the slider sliderSelection.hide(); // Set the initial value of the tooltip to "Please Select" unless the slider // has already been changed. slider.setAttribute('formatter', function(val) { return slideStarted ? val : "Please Select"; }); // Relayout the slider to apply the formatter change above slider.relayout(); // Register the "slideStart" event of the slider to change the tool tip and show the selection // bar when the slider is changed. slider.on('slideStart', function() { if (!slideStarted) { slideStarted = true; sliderSelection.show(); } }); }; // Loop through the sliders on the page to apply the default formatting for (var value of Object.keys(sliders)) { // Get a handle for each slider within the object var slider = window.activeSliders[value].getSlider(); // Set the styling for each slider myFunc(slider); } }