Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Harmonic Design

    (@harmonic_design)

    Hi mehdis6211,
    the timer hides the quiz behind a “start quiz” button for good reasons, so I strongly recommend leaving it — especially on your site. It will give your users a better experience.

    For example, your own site has intro copy letting users know about the quiz and giving instructions. And then scrolling down, there is a giant image that you have to scroll past. And then below the image there is the quiz. But wait, I can’t select an answer yet because there is a newsletter popup that I have to close first. Now imagine that the quiz timer was running as soon as the page loads.

    The Start Quiz button is there to avoid all of the above. If the user wants to read your instructions, they can do so without the pressure of a countdown timer. If they want to subscribe to your newsletter, then they can do so without running out of time to complete the quiz. And so on. Hope this makes sense!

    HOWEVER, if you don’t care about any of the above and want the timer to start immediately as soon as your page loads, let me know. I can provide you with code you can add to your theme that will automatically “click” the Start Quiz button as soon as it’s ready.

    Thread Starter mehdis6211

    (@mehdis6211)

    Thanks for the help
    I had already activated the button to start the test, unfortunately, the visits to my site decreased, most of the users were sending messages and could not start the test.
    Please post the code if possible
    Thanks

    Plugin Author Harmonic Design

    (@harmonic_design)

    Add the following to your theme’s functions.php file. BACKUP THE FILE FIRST.

    function hdq_mehdis6211_init($data)
    {	
    	array_push($data->hdq_init, "hdq_mehdis6211_after");
    	return $data;
    }
    add_action("hdq_init", "hdq_mehdis6211_init");
    
    function hdq_mehdis6211_after()
    {
    	?>
    <script>
    function hdq_mehdis6211_after(){
    	const sel = document.getElementsByClassName("hdq_quiz_start");
    	if(sel.length == 0){
    		return;
    	}
    	sel[0].click();
    }
    </script>
    	<?php
    }
    add_action("hdq_after", "hdq_mehdis6211_after");

    The above function does two things. First, it tells HD Quiz to run a custom JavaScript function once HD Quiz has loaded. Second, it prints the custom JavaScript function after each quiz. The JS function simply clicks on the start quiz button automatically.

    Thread Starter mehdis6211

    (@mehdis6211)

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.