• Resolved Adrian

    (@wadoadi)


    Hi,
    I’m still in the process of setting my first quiz up and would like to ask the following questions?

    To set the scene my quiz has 1 question per page using the pagination option per question, the timer is set, I have Immediately mark answer as correct or incorrect, questions are a subset of questions from a question bank and both question and answer orders are randomised.

    1. After each question the person selects next and the next question is displayed however the page scrolls down to the bottom which cuts the top of the question off. How can I stop the scrolling action?

    2. I would like to add line breaks to some of the questions. Can I do this with \n or </br> within the question text?

    3. I have the “Immediately mark answer as correct or incorrect” option on however this is not working on my site! is this due to the pagination?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter Adrian

    (@wadoadi)

    re 2 above, <br> seems to work fine, in case anyone else is wanting to do the same.

    Plugin Author Harmonic Design

    (@harmonic_design)

    Hi Adrian,
    basic formatting HTML can be used. So things like strong, em, sup, and yes, br 🙂

    For your other question, are you using the WP Paginate feature or are you enabling “paginate” on each question? If the former, that is not compatible with some of the options are you are using such as the pool of questions and randomized order.

    For the others, it seems you have an error on the site that is breaking scripts. Probably your theme or another plugin. Are you able to post a link to a quiz so I can take a look? If not, take a look at your browser console to see if there are any script errors.

    Thread Starter Adrian

    (@wadoadi)

    thank you, I have 2 and 3 working, 3 was down to me only having one of the required options checked in marking (sorry).

    however, it seems in doing so I have introduced a new issue!

    so number 1 the auto-scrolling is still an issue for me. This is on all questions after the first one.

    My new issue is that I now get a “Next” button after the “Start Quiz” button I still get all 25 questions from the bank. Before the Start quiz started the quiz now I have to click start quiz and then next before the first question comes up.

    i have published the quiz to the following test page https://getyourwings.co.uk/quiz-testing/

    thanks for your help

    Plugin Author Harmonic Design

    (@harmonic_design)

    The scrolling is due to the way your sticky navigation is set up. You can try to enable the legacy scroll feature (found on the about / options page) to compensate.

    As for the “next” button – this is because you have paginate on each question. Normally, the solution would be to not enable paginate on the first question, but since you have your questions randomized… (btw: the reason it doesn’t do this automatically is that a lot of users want to have the next button show first to start the quiz in case they are not using a timer).

    So for that, you can either “live with it”, OR you can add some javascript to auto click the next button once the “start quiz” button has been clicked 🙂

    HD Quiz has a hook called hdq_after that you can use to add some custom JavaScript to the page, or you can just add the script to your footer if that’s easier.

    Here is code you can add to your theme’s function.php file.

    
    function hdq_after_wadoadi()
    {
    	?>
    <script>
    const start  = document.getElementsByClassName("hdq_quiz_start")[0];
    const first_next = document.getElementsByClassName("hdq_next_button")[0];
    start.addEventListener("click", function(){
    	setTimeout(
    		function(){
    			first_next.click();
    		},
    		100
    	); // small delay
    })
    </script>
    	<?php
    }
    add_action("hdq_after", "hdq_after_wadoadi");

    What this does is add that javascript to the end of each quiz that will automatically click the first “next” button once the quiz starts.

    Thread Starter Adrian

    (@wadoadi)

    Thank you, I will try that in the morning and will report back.

    I’m having the same issue with the auto scroll. Each time I select “Next” it scrolls the screen to the bottom of the page. Is there any workaround for this? I tried checking off the legacy scroll option, but it didn’t help.

    Thread Starter Adrian

    (@wadoadi)

    I don’t have it fixed…

    Oh man. I’m Googling trying to find some solution to disable the scroll, but nothing yet…

    Plugin Author Harmonic Design

    (@harmonic_design)

    Hi @sim183 sim183,
    please make a new thread for this question since it is an unrelated issue and it will be easier for others to find if anyone else ever has a similar issue. Also please include a link to a quiz

    This thread was about the user’s sticky header covering parts of the question when scrolled. Yours is that the site is always scrolling to the bottom.

    Will do.

    Plugin Author Harmonic Design

    (@harmonic_design)

    @wadoadi I’m sorry to hear that your sticky header issue was never resolved. Last I heard from you was

    Thank you, I will try that in the morning and will report back.

    Taking a look at your site… I’m not seeing the issue? I see that you are not using the legacy scroll, but the scrolling seems to be working for you on mobile desktop and mobile.

    Thread Starter Adrian

    (@wadoadi)

    sorry yes, the scrolling issue was a compatibility issue with the ad system I was using, since disabling it the scrolling has been ok, with or without legacy mode.

    It was the Next to begin part I could not get to work. I was trying to add the code via PHP snippets.

    Sorry

    Plugin Author Harmonic Design

    (@harmonic_design)

    No worries.

    That code needs to be added to your theme’s functions.php file – not added via some other plugin. The reason is that we need to run the code at the correct time or it won’t work. The code I sent was written in a way to ensure that it will only load and run alongside HD Quiz – this way it will not load on any other pages or cause any possible issues.

    You can add that code by going to appearance -> theme editor, then selecting functions.php in the right sidebar. NOTE: I super strongly DEMAND that you make a backup of your functions.php file before editing. This way you can quickly restore if you make a mistake. The very top of the file should contain <?php <- after this is the best place to add the custom code.

    Thread Starter Adrian

    (@wadoadi)

    AMAZING THANK YOU that works great

    Plugin Author Harmonic Design

    (@harmonic_design)

    Great; glad it’s working well for you 🙂 Please consider leaving a review if you have the time, and let me know if anything else comes up that you need help with.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Pagination and scrolling’ is closed to new replies.