Check out the LimeSurvey source code on GitHub!

changing question div layout per group

More
4 years 11 months ago #76788 by chrisadam
Hi guys how can I apply CSS design elements to only effect certain groups..?

Such as I want to create a layout that looks like one way in group 1 and in group 2 questions, I want them to have some side to side, some in columns and some in rows..

I know in css and html I can edit the entire quesiton section and have done so, but how do I apply certain layout looks only to certain groups?

(or even within groups so I can move things around)

IS there a way to identify group layouts in css?


Thank you
Chris

Please Log in to join the conversation.

More
4 years 11 months ago #76792 by DenisChenu
Hello,

In group by group and all in one, all group are surrounded by a div id="group$GroupNumber"

The you can use some cs like that:
#group122{background:red}
#group123{background:green}

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
4 years 11 months ago #76797 by tpartner
If using group-by-group mode, you can use JavaScript to add a group-specific class to the body element. Add the following to the end of template.js:
	$(document).ready(function() {
 
		// Find the group ID
		if($( 'input#fieldnames' ).length != 0) {
			var fieldNames = $( 'input#fieldnames' ).attr('value');
			var tmp = fieldNames.split('X');
			var gID = tmp[1];
		}	
 
		// Add a group-specific class to the body element
		$('body').addClass('group-'+gID+'');	
 
	});

Then in template.css, something like this:
body.group-122 {
    /* some rule */
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form