Hello all,
I have piped in the starting position on a slider question from a previous question (and manipulated it by adding 20). I also got the tooltip box to display the manipulated value. However, I can't align the tooltip box to be above the slider handle. Can anyone help me with this? Thanks a lot! Here is my code so far:
{
var that = this.questionId;
var result = parseInt("${q://QID139/TotalSum}");
var value = result + 20;
this.setChoiceValue(1, value);
document.getElementById(that + '~1~toolTipBox').innerHTML = value;
document.getElementById(that + '~1~toolTip').style.top = '-84px';
document.getElementById(that + '~1~toolTipBox').style.width= value + "px";
});
How to align the tooltip box with the slider handle?
Best answer by Tom_1842
Hi there, if you still need, I was able to put this in place by adding the below JS to the slider question, updated with your Constant Sum Total QID139.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var result = parseInt("${q://QID139/TotalSum}");
var value = result + 20;
this.setChoiceValue(1, value);
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
var qid = this.questionId;
var result = parseInt("${q://QID139/TotalSum}");
var value = result + 20;
var left1 = document.getElementById(qid + '~1~handle').style.left;
document.getElementById(qid + '~1~toolTip').style.top = '-84px';
document.getElementById(qid + '~1~toolTipBox').innerHTML = value;
document.getElementById(qid + '~1~toolTip').style.left = left1;
document.getElementById(qid + '~1~toolTip').style.display = "block";
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Also, the -84 sounds like you are using Modern laout. If anyone needs to update for Classic or Flat, Classic is -51 on both desktop and mobile but Flat is -65 on desktop and -59 on mobile because the font changes at 480px. To get around that, set the JS for -65 and add the below CSS to the survey's Look & Feel in the Style section:
@media (max-width: 480px) {
.JFEScope .BarContainer .sliderToolTipBox {
font-size: 18px !important;
}
}
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
