Question T9289
Visible to All Users

How scroll to top when multiples pages

created 3 years ago

I'm using the Wordpress plugin of the SurveyJS and not using any code. I saw some solutions for this but I need to use some code but I do not know how to add it using the Wordpress plugin.

Is there any option to scroll to the top of the page when changing the page. I'm using a Matrix question with 10 rows. I have enable the Focus on fisrt question but when changing of page it shows the bottom part of the next page instead the top.

Thanks,

Antonio

Answers approved by surveyjs Support

created 3 years ago

Hello,

Here is the place where survey model is created - https://github.com/surveyjs/surveyjs-wordpress/blob/master/src/trunk/initializer.php#L180
You can subscribe the https://surveyjs.io/Documentation/Library?id=surveymodel#onCurrentPageChanged event and call the https://surveyjs.io/Documentation/Library?id=surveymodel#focusFirstQuestion method to focus first question. The focused element will be scrolled into view automatically.

Thanks, Serge
SurveyJS Team

    Other Answers

    created 3 years ago

    Hi there,

    Thenks for the answer. It really helped me. But I have a question. I add the code directly on the SurveyJS code, but when the plugins is updated I will loose the code I added. Is there a way to add the code outside SurveyJS php file?

    Thanks

      Comments (2)

        Hello,

        Since this feature is not implemented in original plugin code, you need to patch the Wodpress plugin code. After that it becomes your own custom Wodpress plugin.
        In fact SurveyJS Wodpress plugin is a live demo of SurveyJS products. Some of them (Creator, PDF Export and Analytics) are commercial and require a license to be used in custom applications.

        Thanks, Serge
        SurveyJS Team

          Thanks