Created
September 27, 2020 22:14
-
-
Save bradleyallf/74e38e53b22b4c9ea32578b157319e30 to your computer and use it in GitHub Desktop.
Attempt at getting custom graphic slider to a particular start position in JS for Qualtrics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Qualtrics.SurveyEngine.addOnload(function() | |
{ | |
/*Place your JavaScript here to run when the page loads*/ | |
/*Place your JavaScript here to run when the page is fully displayed*/ | |
Qualtrics.SurveyEngine.addOnReady(function() { | |
//Initialize graphic slider | |
var init = "url(https://ncsu.ca1.qualtrics.com/ControlPanel/Graphic.php?IM=IM_5vjllrLOlc1oFtH) no-repeat"; //update to initial graphic to show | |
var qid = this.questionId; | |
var q = jQuery("#"+qid); | |
if(q.find('.SSTrack.activated').length == 0) { //not already set (support previous button) | |
q.find('.handle').css("top", "100px"); //initialize slider | |
q.find(".SSImage>.SSImage:visible").hide(); //hide default graphic | |
jQuery(("#Image_QR~"+qid+"@"+init).replace(/(~|@)/g, "\\$1")).show(); //show init graphic | |
} | |
}); | |
var imgs = jQuery("#"+this.questionId+" div.SSImage > div.SSImage"); | |
imgs[0].style.background = "url(https://ncsu.ca1.qualtrics.com/ControlPanel/Graphic.php?IM=IM_5vjllrLOlc1oFtH) no-repeat"; | |
var imgs = jQuery("#"+this.questionId+" div.SSImage > div.SSImage"); | |
imgs[1].style.background = "url(https://ncsu.ca1.qualtrics.com/ControlPanel/Graphic.php?IM=IM_abXP7xumZW0LMQ5) no-repeat"; | |
var imgs = jQuery("#"+this.questionId+" div.SSImage > div.SSImage"); | |
imgs[2].style.background = "url(https://ncsu.ca1.qualtrics.com/ControlPanel/Graphic.php?IM=IM_bdXIB07j1v0N3mJ) no-repeat"; | |
var imgs = jQuery("#"+this.questionId+" div.SSImage > div.SSImage"); | |
imgs[3].style.background = "url(https://ncsu.ca1.qualtrics.com/ControlPanel/Graphic.php?IM=IM_4UAfkFtRClsDSFT) no-repeat"; | |
var imgs = jQuery("#"+this.questionId+" div.SSImage > div.SSImage"); | |
imgs[4].style.background = "url(https://ncsu.ca1.qualtrics.com/ControlPanel/Graphic.php?IM=IM_8941uMZP0xpe1yB) no-repeat"; | |
}); | |
Qualtrics.SurveyEngine.addOnReady(function() | |
{ | |
}); | |
Qualtrics.SurveyEngine.addOnUnload(function() | |
{ | |
/*Place your JavaScript here to run when the page is unloaded*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment