/    Sign up×
Community /Pin to ProfileBookmark

JavaScript Slider Scale Question

In a survey I’m trying to build, I have two slider scales on the same page. I’d like to make the second scale disappear (without reloading the page) if the respondent chooses a certain value on the first scale.

I believe I can accomplish this with an if statement plus some other code I have. However, since I’m working off of source code from Qualtrics and I am not a coder, I’m not sure how the value of the slider (i.e., where it is clicked) is registered and, therefore, what to test for in the conditional. (i.e., if ([I]what?[/I] = 0) …)

Is anyone able to figure this out from any of the following chunks of code??:

.yui-h-slider,.yui-v-slider,.yui-region-slider{position:relative;}.yui-h-slider .yui-slider-thumb,.yui-v-slider .yui-slider-thumb,.yui-region-slider .yui-slider-thumb{position:absolute;cursor:default;}.yui-skin-sam .yui-h-slider{background:url([url]http://yui.yahooapis.com/2.8.2r1/build/slider/assets/skins/sam/bg-h.gif[/url]) no-repeat 5px 0;height:28px;width:228px;}.yui-skin-sam .yui-h-slider .yui-slider-thumb{top:4px;}.yui-skin-sam .yui-v-slider{background:url([url]http://yui.yahooapis.com/2.8.2r1/build/slider/assets/skins/sam/bg-v.gif[/url]) no-repeat 12px 0;height:228px;width:48px;}.yui-skin-sam .yui-region-slider{height:228px;width:228px;}

var INEXPO=Effect.Transitions.InExpo;var ELASTIC=Effect.Transitions.Elastic;Effect.Transitions.Elastic=function(pos){return-1*Math.pow(4,-8*pos)*Math.sin((pos*6-1)*(2*Math.PI)/2)+1;};Effect.Transitions.SwingFromTo=function(pos){var s=5.70158;if((pos/=0.5)<1)return 0.5*(pos*pos*(((s*=(1.525))+1)*pos-s));return 0.5*((pos-=2)*pos*(((s*=(1.525))+1)*pos+s)+2);};Effect.Transitions.SwingFrom=function(pos){var s=1.70158;return pos*pos*((s+1)*pos-s);};Effect.Transitions.SwingTo=function(pos){var s=1.70158;return(pos-=1)*pos*((s+1)*pos+s)+1;};Effect.Transitions.Bounce=function(pos){if(pos<(1/2.75)){return(7.5625*pos*pos);}else if(pos<(2/2.75)){return(7.5625*(pos-=(1.5/2.75))*pos+0.75);}else if(pos<(2.5/2.75)){return(7.5625*(pos-=(2.25/2.75))*pos+0.9375);}else{return(7.5625*(pos-=(2.625/2.75))*pos+0.984375);}};Effect.Transitions.BouncePast=function(pos){if(pos<(1/2.75)){return(7.5625*pos*pos);}else if(pos<(2/2.75)){return 2-(7.5625*(pos-=(1.5/2.75))*pos+0.75);}else if(pos<(2.5/2.75)){return 2-(7.5625*(pos-=(2.25/2.75))*pos+0.9375);}else{return 2-(7.5625*(pos-=(2.625/2.75))*pos+0.984375);}};
Effect.Transitions.EaseFromTo=function(pos){if((pos/=0.5)<1)return 0.5*Math.pow(pos,4);return-0.5*((pos-=2)*Math.pow(pos,3)-2);};Effect.Transitions.EaseFrom=function(pos){return Math.pow(pos,4);};Effect.Transitions.EaseTo=function(pos){return Math.pow(pos,0.25);};Control.Slider.prototype.initialize=function(handle,track,options){var slider=this;if(Object.isArray(handle)){this.handles=handle.collect(function(e){return $(e)});}else{this.handles=[$(handle)];}

<div class=’QuestionOuter Slider BorderColor’ id=’QID585′ QuestionID=’QID585′ PostTag=”QID585″>
<script>
try {
Qualtrics.SurveyEngine.QuestionInfo[“QID585”] = {“QuestionID”:”QID585″,”QuestionText”:””,”QuestionType”:”Slider”,”Choices”:{“1”:{“RecodeValue”:”1″,”VariableName”:”Click to write Choice 1″,”Text”:”Click to write Choice 1″,”Exclusive”:false}},”Validation”:{“Settings”:{“ForceResponse”:”OFF”}},”Selector”:”HBAR”,”SubSelector”:null};
}
catch(e){}

Any help in figuring out what to test in the conditional (where the clicked value is stored) would be extremely appreciated. Otherwise, if no value is detected until the page is submitted, perhaps it would be possible to insert my own function that would temporarily store the value? Thanks to anyone willing to take a look and lend a hand.

Note to mods: if you believe that posting source code in this way or for this purpose violates copyright, please delete this thread. Thanks!

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @NadaCoder spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...