Hiding slider handle by default until user clicks on slider

More
5 years 7 months ago #77886 by davidspivak
davidspivak created the topic: Hiding slider handle by default until user clicks on slider
Hi,

Does anyone know how to do that (using multiple numerical input question)?

I actually did find a solution here , but I have no idea what the code means or what to do with it (where do I put it? needs additional coding?)

I'd appreciate any help,
David

Please Log in to join the conversation.

More
5 years 7 months ago #77890 by tpartner
tpartner replied the topic: Hiding slider handle by default until user clicks on slider
Add the following to the end of template.js:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() { 
 
		$('.ui-slider-handle').hide();
 
		$('.ui-slider').mousedown(function(){
			$('.ui-slider-handle', this).show();
		});
	});
 
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 7 months ago #77894 by davidspivak
davidspivak replied the topic: Hiding slider handle by default until user clicks on slider
Thanks so much!

It didn't work when I added it to template.js, but it did work when I added it to the question itself.

Please Log in to join the conversation.

More
5 years 7 months ago #77923 by Mazi
Mazi replied the topic: Hiding slider handle by default until user clicks on slider

davidspivak wrote: Thanks so much!

It didn't work when I added it to template.js, but it did work when I added it to the question itself.

When using the <script> tag, the code always has to be added at the question. Also see this tutorial on how to use Javascript at Limesurvey .


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 7 months ago #77945 by tpartner
tpartner replied the topic: Hiding slider handle by default until user clicks on slider

It didn't work when I added it to template.js, but it did work when I added it to the question itself.

Oop, sorry, I shouldn't have included the <script> tags.

To use in template.js:
 
	$(document).ready(function() { 
 
		$('.ui-slider-handle').hide();
 
		$('.ui-slider').mousedown(function(){
			$('.ui-slider-handle', this).show();
		});
	});

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!