Thomas Gibbons Consulting Qualtrics Wiki

Contact TomG on Qualtrics Community

User Tools

Site Tools


freezetopq

freezeTopQ - Freeze 1st question to top of page on scroll

The freezeTopQ function freezes (sticks) the first question on the page (typically a descriptive text question) to the top of the page when the page is scrolled. Functionality includes:

  • Smooth scrolling
  • Automatically sets matching background color if transparent
  • Optionally set padding of first question to override theme

Here is a quick video demonstration:

This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.

Set-up Instructions

Add Function To Survey

To make the function available to all page/questions in the survey, copy the function to the Survey Header inside a script tag: Add the freezeTopQ function to the survey header to make it available to any page/question in the survey. Go to Look & Feel → General → Header edit → and paste the provided freezeTopQ function JS:

<script>/*Paste freezeTopQ function JS here*/</script>

Alternatively, paste the freezeTopQ function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.

JavaScript Function Call

Add JS to call the freezeTopQ function to apply it to the first question on a page (the question to be frozen at the top) as follows:

Qualtrics.SurveyEngine.addOnload(function() {
	freezeTopQ(this);
});

To adjust top or bottom question padding, specify the desired options in the second function argument as an object. For example:

Qualtrics.SurveyEngine.addOnload(function() {
	freezeTopQ(this,{paddingTop:"5px",paddingBottom:"5px"});
});

Options

paddingBottom

paddingBottom specifies the bottom padding of the first question.

Default: theme default

paddingTop

paddingTop specifies the top padding of the first question.

Default: theme default

Qualtrics Wiki

freezetopq.txt · Last modified: 2023/09/24 15:56 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki