- Posts: 9
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Loop through all questions (except boilerplates) and add some classes $('div[id^="question"]').each(function(i){ if (!$(this).hasClass('boilerplate')) { $(this).addClass('inlineQuestion'); if(i < 1) { $(this).addClass('inlineQuestionPrime'); } else { $(this).addClass('inlineQuestionSub'); } } }); // Wrap the questions in a div $('.inlineQuestion').wrapAll('<div class="inlineWrapper" />'); // Remove the text from the secondary questions $('.inlineQuestionSub th.answertext').text(''); // Apply some styles (these are for the default template) $('.inlineQuestion').css({ 'float': 'left' }); $('.inlineQuestion col, .inlineQuestion th.answertext').css({ 'width': 'auto' }); $('.inlineQuestion .question-wrapper').css({ 'width': '100%' }); $('.inlineQuestion td.answer').css({ 'padding': '0.5em 0' }); $('.inlineQuestion td.questiontext').css({ 'text-align': 'center' }); // Center the wrapper div var wrapperWidth = 0; $('.inlineQuestion').each(function(i){ wrapperWidth = wrapperWidth + $(this).width(); var padLeft = $('.answertext:eq(0)', this).width() + 3; $('.questiontext', this).css({ 'padding-left':padLeft+'px', 'padding-right':'3px' }); }); $('.inlineWrapper').css({ 'width':wrapperWidth+'px', 'margin': '0 auto' }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Loop through all questions (except boilerplates) and add some classes $('div[id^="question"]').each(function(i){ if (!$(this).hasClass('boilerplate')) { $(this).addClass('inlineQuestion inlineQuestionSub'); } }); $('.inlineQuestionSub:first').removeClass('inlineQuestionSub').addClass('inlineQuestionPrime'); // Wrap the questions in a div $('.inlineQuestion').wrapAll('<div class="inlineWrapper" />'); // Remove the text from the secondary questions $('.inlineQuestionSub th.answertext').text(''); // Apply some styles (these are for the default template) $('.inlineQuestion').css({ 'float': 'left' }); $('.inlineQuestion col, .inlineQuestion th.answertext').css({ 'width': 'auto' }); $('.inlineQuestion .question-wrapper').css({ 'width': '100%' }); $('.inlineQuestion td.answer').css({ 'padding': '0.5em 0' }); $('.inlineQuestion td.questiontext').css({ 'text-align': 'center' }); // Center the wrapper div var wrapperWidth = 0; $('.inlineQuestion').each(function(i){ wrapperWidth = wrapperWidth + $(this).width(); var padLeft = $('.answertext:eq(0)', this).width() + 3; $('.questiontext', this).css({ 'padding-left':padLeft+'px', 'padding-right':'3px' }); }); $('.inlineWrapper').css({ 'width':wrapperWidth+'px', 'margin': '0 auto' }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Loop through all questions (except boilerplates) and add some classes $('div[id^="question"]').each(function(i){ if (!$(this).hasClass('boilerplate')) { $(this).addClass('inlineQuestion inlineQuestionSub'); } }); $('.inlineQuestionSub:first').removeClass('inlineQuestionSub').addClass('inlineQuestionPrime'); // Wrap the questions in a div $('.inlineQuestion').wrapAll('<div class="inlineWrapper" />'); // Remove the text from the secondary questions $('.inlineQuestionSub th.answertext').text(''); // Apply some styles (these are for the default template) $('.inlineQuestion').css({ 'float': 'left' }); $('.inlineQuestion col, .inlineQuestion th.answertext').css({ 'width': 'auto' }); $('.inlineQuestion .question-wrapper').css({ 'width': '100%' }); $('.inlineQuestion td.answer').css({ 'padding': '0.5em 0' }); $('.inlineQuestion td.questiontext').css({ 'text-align': 'center' }); // Center the wrapper div var wrapperWidth = 0; $('.inlineQuestion').each(function(i){ wrapperWidth = wrapperWidth + $(this).width(); var padLeft = $('.answertext:eq(0)', this).width() + 3; $('.questiontext', this).css({ 'padding-left':padLeft+'px', 'padding-right':'3px' }); }); $('.inlineWrapper').css({ 'width':wrapperWidth+'px', 'margin': '0 auto' }); // Set the row heights var wrapperWidth = 0; $('.inlineQuestionSub').each(function(i){ $('tbody[id^="javatbd"]', this).each(function(i){ var ansHeight = $('.inlineQuestionPrime th.answertext:eq('+i+')').innerHeight(); //$('th.answertext', this).css({ 'height':ansHeight+'px' }); if($.browser.mozilla) { $('th.answertext', this).height(ansHeight); } else { $('th.answertext', this).innerHeight(ansHeight); } }); }); }); </script>