Different body class

Mehr
3 Jahre 5 Monate her #104725 von Pulsor
Pulsor erstellte das Thema Different body class
Hello Everyone,

I'm new here. I posted this on the Developer section too, since I don't know where to put it exactly.

I need to know if there's a way to add a code in the
<body class="default lang-{SURVEYLANGUAGE} {SURVEYFORMAT}">
(the body class line of startpage.pstpl).

What I'm trying to accomplish is to add different backgrounds: in the welcome page, question pages, and in the endpage.

If the answer's no, please be sure that the 'no' is definitive.


Thanks in advance guys!

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 5 Monate her #104731 von tpartner
tpartner antwortete auf das Thema: Different body class
A JavaScript solution...

Add this to the end of welcome.pstpl:
<script type="text/javascript" charset="utf-8">		
	$(document).ready(function(){
		$('body').addClass('welcome-page');
	});
</script>


And this to question.pstpl:
<script type="text/javascript" charset="utf-8">		
	$(document).ready(function(){
		$('body').addClass('welcome-page');
	});
</script>


And this to endpage.pstpl:
<script type="text/javascript" charset="utf-8">		
	$(document).ready(function(){
		$('body').addClass('end-page');
	});
</script>


.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: Pulsor

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 5 Monate her #104765 von Pulsor
Pulsor antwortete auf das Thema: Different body class
Thanks a lot! I will try this out and see how it goes.



Regards,

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 5 Monate her #104785 von Pulsor
Pulsor antwortete auf das Thema: Different body class
Ok, tried those codes and it seems to work. Thanks a lot tpartner! Now welcome page has its own body class, so does question and endpage. Now, I need to add a different body class per question-made page.

For example, my survey has 17 questions, so there's a total of 17 'pages'. I need every body of those to have a different class. I know that each questions has an identifier code, so maybe there's a way to get it and add it in the body class. I don't know.


Any ideas?



Thanks in advance!

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 5 Monate her #104796 von DenisChenu
DenisChenu antwortete auf das Thema: Different body class
Hi,

Activate "show question code" in survey settings, remove the default part with {QCODE} in question.pdtpl, and add this:
<script type="text/javascript" charset="utf-8">		
$(document).ready(function(){$('body').addClass({QCODE});});
</script>
(same than tpartner code)

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).
An error happen ? Before make a new topic : remind the Debug mode .
Folgende Benutzer bedankten sich: Pulsor

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 5 Monate her #104845 von Pulsor
Pulsor antwortete auf das Thema: Different body class
Thanks DenisChenu, the js seems to work just fine! Tho I had to add {QUESTION_CODE} instead of {QCODE}. Guess it's my LS version. Also, had to put '' between that code.

Btw, about tpartner code, I've added the 'end-page' script on completed.pstpl instead of endpage.pstpl, since welcome and endpage files are related. When I changed the body bg in the beginning, it was the same at the end (which I didn't wanted).


Thanks again both of you guys, you've been a great help! And sorry for my english heh.

Bitte Anmelden um der Konversation beizutretten.

Haben Sie schon bei unserer Kundenumfrage mitgemacht?

Verpassen Sie nicht Ihre Chance auf tolle Preise.

Klicken sie hier um teilzunehmen:

Jetzt starten

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten