Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Loading Icon after clicking button to next question

  • DanielFriedrichSchulz
  • DanielFriedrichSchulz's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago - 7 years 1 month ago #158620 by DanielFriedrichSchulz
Loading Icon after clicking button to next question was created by DanielFriedrichSchulz
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:
Code:
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: 7 years 1 month ago by DanielFriedrichSchulz.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
7 years 1 month ago #158622 by DenisChenu
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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • DanielFriedrichSchulz
  • DanielFriedrichSchulz's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #158643 by DanielFriedrichSchulz
Replied by DanielFriedrichSchulz on topic Loading Icon after clicking button to next question
Thank you very very much. You helped me a lot.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose