Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

0 votes

Hi,

I have a question with one correct (always on the right side) and one incorrect (always left) offered answer and need participants decide between them with their estimation of their confidence in the chosen answer. Also, the polarities of the scale are set to change randomly.
I decided to use two-sided slider and implemented the following code, but this code made the slider appear in range from -100 to 0 on the left side, and in range from 0 to 100 on the right side of the slider. Instead of this, I need the range from 100 to 0 on the left, and from 0 to 100 on the right side of the slider.

I hope somebody has a suggestion how to gaint this.

Thank you!

The code I used:

 <script type="text/javascript">
<!--
var formatter = function(value) {
  if (value < 0) return "";
  var text = ((value - 51) / 50 * 100).toFixed(1) + "%";
  if (value > 51) {
    text = text;
  }
  return text;
}
SoSciSliders.setFormat(formatter);
// -->
</script>
in SoSci Survey (English) by s174885 (145 points)
edited by SoSci Survey

1 Answer

0 votes

You may either remove the minus ...

var text = ((value - 51) / 50 * 100).toFixed(1) + "%";
text = text.replace(/^-/, "");

Or you could use Math.abs()

var text = Math.abs((value - 51) / 50 * 100).toFixed(1) + "%";

to get rid of the negative values.

by SoSci Survey (222k points)
...