survey/app/assets/javascripts/survey-front-form.js

24 lines
618 B
JavaScript
Raw Normal View History

2021-07-08 13:31:27 +00:00
function repeat_string(str,num){
var tmp="";
for (var i=0;i<num;i++){
tmp += str;
}
return tmp;
}
function set_dot_for_double_level(){
var width = $('div.o-question').width()
var font_size = parseInt($('.double-level .o-question-option').css('font-size').slice(0,-2))
$('.double-level tr').each(function(){
var tr_w = $(this).find('.o-question-option').width()+$(this).find('.level2-list').width()
if (tr_w/width<0.95){
$('.dot').text(repeat_string('•',(width*0.95-tr_w)/font_size-2))
}
})
}
$(function(){
set_dot_for_double_level()
})
$(window).resize(function(){
set_dot_for_double_level()
})