Loading Icon after clicking button to next question

More
2 months 1 week ago - 2 months 1 week ago #158620 by DanielFriedrichSchulz
DanielFriedrichSchulz created the topic: Loading Icon after clicking button to next question
Hi All,

I am trying to add a loading Window/icon to question with a long loading time but after trying myself it is not easy. I have used this code so far in "script/template.js:
document.onreadystatechange = function () {
  var state = document.readyState
  if (state == 'complete') {
      setTimeout(function(){
            document.getElementById('loading');
            document.getElementById('probe').style.visibility="hidden";
      },1000);
  }
}

But the Loading window just show up while the page is loading and after each question. I am trying to extend this period from the moment I click on the next button until the page is completely loaded. It would be great if you can help me.

Thank you very much
Last Edit: 2 months 1 week ago by DanielFriedrichSchulz.

Please Log in to join the conversation.

More
2 months 1 week ago #158622 by DenisChenu
DenisChenu replied the topic: Loading Icon after clicking button to next question
The way is to :
Add a loading class to the body,
Remove this class with jquery ready function (best is to replace with loaded)

And add an element at start of your page show when body class name is loading, hide other element when class is loading.
Add the class when the page is unloaded.

See example in (old, not 2.5X compatible) SkeletonQuest
framagit.org/Shnoulle/SkeletonQuest/blob/master/template.js#L22
framagit.org/Shnoulle/SkeletonQuest/blob/master/template.js#L47
framagit.org/Shnoulle/SkeletonQuest/blob/master/template.js#L50
framagit.org/Shnoulle/SkeletonQuest/blob...-ui-custom.css#L1292

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

Please Log in to join the conversation.

More
2 months 1 week ago #158643 by DanielFriedrichSchulz
DanielFriedrichSchulz replied the topic: Loading Icon after clicking button to next question
Thank you very very much. You helped me a lot.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!