====== 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:\\ {{ ::freezetopq_demo.mp4?650 |freezeTopQ Demonstration}} This function is available for a reasonable fee. Contact **[[https://community.qualtrics.com/inbox/conversation?with=373|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 -> {{::icon_source.jpg?20|}} and paste the provided freezeTopQ function JS: 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 **[[freezetopq#options|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 ====== [[start|Qualtrics Wiki]]