User Tools

Site Tools


freezetopq

This is an old revision of the document!


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:

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>

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

freezetopq.1602509082.txt.gz · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki