- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Adding animation when changing question divs from display:none to display:block?
- sydeburn
- Topic Author
- Offline
- New Member
Less
More
11 years 6 months ago #86095
by sydeburn
Adding animation when changing question divs from display:none to display:block? was created by sydeburn
Hi all, I've just started using LimeSurvey and I'm amazed at all it can do.
I've been doing some customizing on the visual side of things and there's one point I'm stuck at.
Several of the questions in my survey are conditionalized so they only appear if the question before them is answered in a certain way. From the code I can see that this is done by changing the css property display:none to display:block. I'd like to change this so they use the jquery slideDown/slideUp animations, something like:
function showDiv(divId) {
$("#" + divId).slideDown(250);
}
function hideDiv(divId) {
$("#" + divId).slideUp(250);
}
I assume this is done with the "checkconditionals" onclick function, but I can't figure out how to change it. Can someone point me in the right direction, or am I creating more work than what it's worth?
I've been doing some customizing on the visual side of things and there's one point I'm stuck at.
Several of the questions in my survey are conditionalized so they only appear if the question before them is answered in a certain way. From the code I can see that this is done by changing the css property display:none to display:block. I'd like to change this so they use the jquery slideDown/slideUp animations, something like:
function showDiv(divId) {
$("#" + divId).slideDown(250);
}
function hideDiv(divId) {
$("#" + divId).slideUp(250);
}
I assume this is done with the "checkconditionals" onclick function, but I can't figure out how to change it. Can someone point me in the right direction, or am I creating more work than what it's worth?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
11 years 6 months ago #86258
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Adding animation when changing question divs from display:none to display:block?
The JavaScript that dynamically shows or hides questions is generated by the core file classes/expressions/LimeExpressionManager.php. Search for "show()" in that file.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- sydeburn
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
11 years 6 months ago #86260
by sydeburn
Replied by sydeburn on topic Adding animation when changing question divs from display:none to display:block?
Thanks for the response. I don't have a classes folder, and a search for LimeExpressionManager.php came up empty. I'm using v2.00+. Where else should I look?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
11 years 6 months ago #86377
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Adding animation when changing question divs from display:none to display:block?
application/helpers/expressions/em_manager_helper.php
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
11 years 6 months ago #86413
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Adding animation when changing question divs from display:none to display:block?
Maybe it can be great if EM use a:
.lsHide() / lsShow fnction to be easyly replaced by own scripting.
And put an handler at end of this function too .
For 2.1 i think.
Denis
.lsHide() / lsShow fnction to be easyly replaced by own scripting.
And put an handler at end of this function too .
For 2.1 i think.
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- sydeburn
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
11 years 6 months ago - 11 years 6 months ago #86483
by sydeburn
Replied by sydeburn on topic Adding animation when changing question divs from display:none to display:block?
Thanks for your help! I got this to work.
I agree a custom function would be a nice addition for future versions.
For my own reference (esp. after upgrades), and anyone else interested, I got this to do what I wanted by doing the following:
In
application/helpers/expressions/em_manager_helper.php
changed line 6488:
$relParts[] = " $('#question" . $arg . "').show();\n";
to
$relParts[] = " $('#question" . $arg . "').slideDown();\n";
changed line 6521:
$relParts[] = " $('#question" . $arg . "').hide();\n";
to
$relParts[] = " $('#question" . $arg . "').slideUp();\n";
I agree a custom function would be a nice addition for future versions.
For my own reference (esp. after upgrades), and anyone else interested, I got this to do what I wanted by doing the following:
In
application/helpers/expressions/em_manager_helper.php
changed line 6488:
$relParts[] = " $('#question" . $arg . "').show();\n";
to
$relParts[] = " $('#question" . $arg . "').slideDown();\n";
changed line 6521:
$relParts[] = " $('#question" . $arg . "').hide();\n";
to
$relParts[] = " $('#question" . $arg . "').slideUp();\n";
Last edit: 11 years 6 months ago by sydeburn.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
11 years 6 months ago #86546
by DenisChenu
Make a Feature request : ideas.limesurvey.org/
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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Adding animation when changing question divs from display:none to display:block?
Please,sydeburn wrote: I agree a custom function would be a nice addition for future versions.
Make a Feature request : ideas.limesurvey.org/
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
11 years 6 months ago #86551
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Adding animation when changing question divs from display:none to display:block?
It would be nice to have a survey setting to have conditional questions either pop-up directly or slide in. Shouldn't be too hard to implement, maybe a good idea for Google Code-in!?
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
11 years 6 months ago #86582
by DenisChenu
For exaple you can change the opacity, pur a visibility:hidden etc ... (in template.js).
If you put an option, it's hard to add an different option. And the option we choose are not good for whole peaople.
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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Adding animation when changing question divs from display:none to display:block?
No, best is to have a jquery extension like lsHide, lsShow, the user ca do what thez want in lsHide/lsShow.Mazi wrote: It would be nice to have a survey setting to have conditional questions either pop-up directly or slide in.
For exaple you can change the opacity, pur a visibility:hidden etc ... (in template.js).
If you put an option, it's hard to add an different option. And the option we choose are not good for whole peaople.
Less than 30 minute of work ...Shouldn't be too hard to implement, maybe a good idea for Google Code-in!?
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
11 years 6 months ago #86601
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Adding animation when changing question divs from display:none to display:block?
Hello,
You don't have to change LS core to do this. You can do it in your template.
Add this at your template.js file:
See demo here : demonstration.sondages.pro/54895/lang-en
Denis
PS: See to update doc after.
You don't have to change LS core to do this. You can do it in your template.
Add this at your template.js file:
Code:
(function($){ $.fn.hide = function(){ $(this).slideUp('slow'); $(this).css('display','none'); }; $.fn.show = function(){ $(this).slideDown('slow', function() { if($(this).is('tbody')){ $(this).css('display','table-row-group'); }else{ $(this).css('display','block'); } }); }; })(jQuery)
See demo here : demonstration.sondages.pro/54895/lang-en
Denis
PS: See to update doc after.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
11 years 6 months ago #86619
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Adding animation when changing question divs from display:none to display:block?
Yup, good thinking Denis
The more flexibility, the better.
The more flexibility, the better.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
8 years 3 weeks ago #133600
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Adding animation when changing question divs from display:none to display:block?
Denis, I was just checking this nice solution at the link you provided (
demonstration.sondages.pro/54895/lang-en
) but it doesn't seem to work anymore. I can't find the mentioned adjustment at the template.js file at
demonstration.sondages.pro/upload/templa...flatblue/template.js
.
Did this get overwritten accidentally?
Can you post an updated link?
Did this get overwritten accidentally?
Can you post an updated link?
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.