choice-multiple-values questions now align after longest string
Added Javascript to template. Adjusted CSS so the max width can be a bit wider. This won't affect Javascript. Still need to refactor so code is tidier - right now same code included multiple times on pages.dj111py38
parent
37429dcf32
commit
ad9b327558
|
@ -110,7 +110,7 @@ html, body {
|
|||
|
||||
span.choice-multiple-values-text {
|
||||
display: inline-block;
|
||||
width: 35%;
|
||||
max-width: 40%;
|
||||
}
|
||||
|
||||
input.sending {
|
||||
|
|
|
@ -19,6 +19,24 @@
|
|||
<!-- </label> -->
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if qdict.type == 'choice-multiple-values' %}
|
||||
<script type="text/javascript">
|
||||
var question = document.getElementById("qc_{{question.number}}");
|
||||
var choice_boxes = question.getElementsByClassName("choice-multiple-values-text");
|
||||
var max_width = 0;
|
||||
for (i = 0 ; i < choice_boxes.length ; i++) {
|
||||
box_width = choice_boxes[i].offsetWidth;
|
||||
if (box_width > max_width)
|
||||
max_width = box_width;
|
||||
}
|
||||
for (i = 0 ; i < choice_boxes.length ; i++) {
|
||||
box_width = choice_boxes[i].offsetWidth;
|
||||
padding = max_width - box_width;
|
||||
if (padding > 0)
|
||||
choice_boxes[i].style.paddingRight = padding + "px";
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if qdict.extras %}
|
||||
{% for key, value in qdict.extras %}
|
||||
|
|
Loading…
Reference in New Issue