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

26 lines
685 B
JavaScript

function repeat_string(str,num){
var tmp="";
for (var i=0;i<num;i++){
tmp += str;
}
return tmp;
}
function set_dot_for_double_level(){
if($('.double-level .o-question-option').length != 0){
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()
})