Hi every one,
i need to add a button on my quiz on the "quiz progress bar" near the timer countdown, that let user to stop/start countdown timer.
have you any idez to help.
thank you in advance
Sanachr

Comments

vijaythummar’s picture

Please provide more detail inform of screen shot or which modules you are using? how are you configuring your quiz?

Thanks,
Vijay Thummar

sanachr’s picture

my reply is not published, but i rewrite it...
i m using opigno quiz to create a test , and i added the jquery countdown to limit the duration of the test, you can see it here
i look for a solution that let me add a stop/start button for this timer, so the user can have a break and return after a while to his test.
thanks in advance
Sanachr

sanachr’s picture

i need an event .click on the div that contains the timer, that let me stop timer running.
thanks

sanachr’s picture

i find this code on the /contrib/jquery_countdown/jquery_countdown/jquery.countdown.js:
/* Pause a countdown widget at the current time.
Stop it running but remember and display the current time.
@param target (element) the containing division */
_pauseCountdown: function(target) {
this._hold(target, 'pause');
},

i have to call this function on an button.onclick event or .click with jquery...
have you an idea how to code it??
thanks

vijaythummar’s picture

Make button or HTML something like

<span class="pause">Pause</span>
<span class="resume">Resume</span>

and your javascript code should be something like

jQuery('.pause').click(function() {
	jQuery('.countdown').countdown('pause');
});

jQuery('.resume').click(function() {
	jQuery('.countdown').countdown('resume');
});

You can change the HTML structure based on your requirement like button or toggle class etc.

Thanks,
Vijay Thummar

sanachr’s picture

thank you, it works fine when i click on stop/resume, but when i refresh page, i find that the timer was working and it displays real time, as if it didn't stop.
you can have a look here and test it
thank you!!

vijaythummar’s picture

You have to calculate "until" value, which is parameter of jQuery countdown on Pause/Resume and set it properly based on current time.

Thanks,
Vijay Thummar