Skip to content

Commit

Permalink
GitBook: [master] 3 pages modified
Browse files Browse the repository at this point in the history
  • Loading branch information
tafakkur authored and gitbook-bot committed Jan 13, 2021
1 parent 2995114 commit 4b08443
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
6 changes: 3 additions & 3 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* [File Download Links](links-to-files.md)
* [Functions](functions/README.md)
* [Sticky Video](functions/make-video-sticky-on-page.md)
* [Clear-Text-Entry-Box](functions/clear-text-entry-box.md)
* [Add Social Media Link in the Survey](functions/add-social-media-link.md)
* [Complex-Display-Logic](functions/complex-display-logic.md)
* [Add Header Row to Matrix](functions/matrix-add-header-row.md)
* [Set-Embedded-on-Page](functions/set-embedded-on-page.md)
* [Clear-Text-Entry-Box](functions/clear-text-entry-box.md)
* [Complex-Display-Logic](functions/complex-display-logic.md)
* [log-values-as-typed](functions/log-values-as-typed.md)
* [Character-Limit-Reminder](functions/character-limit-reminder.md)
* [Constant-Sum-Allow-only-integers](functions/constant-sum-allow-only-integers.md)
* [Timer-Across-Block](functions/timer-across-block.md)
* [Hide-Next-Button-for-a--short-while](functions/hide-next-button-for-a--short-while.md)
* [Set-Embedded-on-Page](functions/set-embedded-on-page.md)
* [Check-sum-dynamically-via-JS](functions/check-sum-dynamically-via-js.md)
* [Deselect-Choices](functions/deselect-choices.md)
* [Remove Powered by Qualtrics](functions/remove-powered-by-qualtrics.md)
Expand Down
12 changes: 6 additions & 6 deletions functions/make-video-sticky-on-page.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Sticky Video

This function allows you to make a video/image/text sticky on the page, so that it displays at all times, even when the participants scroll down. The demo function below is for adding a YouTube video using an iframe, but `innerHTML` can be modified to anything.

[_Link to Working Demo_](https://iima.au1.qualtrics.com/jfe/preview/SV_2rCRZYIQqNq0nzv/BL_ba2DyuPGT8DLF6B?Q_SurveyVersionID=current)
Hold down Ctrl or ⌘ Cmd to open the link in a new tab

_Screenshot_:
This function allows you to make a video/image/text sticky on the page, so that it displays at all times, even when the participants scroll down. The demo function below is for adding a YouTube video using an iframe, but `innerHTML` can be modified to anything.
[_Link to Working Demo_](https://iima.au1.qualtrics.com/jfe/preview/SV_2rCRZYIQqNq0nzv/BL_ba2DyuPGT8DLF6B?Q_SurveyVersionID=current)
Hold down Ctrl or ⌘ Cmd to open the link in a new tab
_Screenshot_:

![](../.gitbook/assets/sticky_video.png)

Expand Down
31 changes: 15 additions & 16 deletions functions/set-embedded-on-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@ This script is a demo of adding/modifying Embedded Data variables based on event

The script shown below allows you to add/modify Embedded Data variables as soon as the choices are submitted.

This allows more flexibility than the *Set Embedded Data* option in the *Survey Flow* section, as that works at block level, while this one works at Page level.
This allows more flexibility than the _Set Embedded Data_ option in the _Survey Flow_ section, as that works at block level, while this one works at Page level.

By modifying it a bit and adding it to the ```addOnReady()``` or ```addOnLoad()``` section, you can even record choices that were selected and then unselected.
By modifying it a bit and adding it to the `addOnReady()` or `addOnLoad()` section, you can even record choices that were selected and then unselected.

```text
Qualtrics.SurveyEngine.addOnPageSubmit(function (type) { // To record the selection when the page is submitted
if (type == "next") {Re
var selChoice = this.getSelectedChoices(); // Get the selected choices
var choiceRef = "";
var choiceText = "";
for (let i = 0; i < selChoice.length; i++) { //Loop over all the choices selected in the question
choiceRef = "#" + this.questionId + "-" + selChoice[i] + "-label > span"; // Create a reference for the choices
if (type == "next") {Re
var selChoice = this.getSelectedChoices(); // Get the selected choices
var choiceRef = "";
var choiceText = "";
for (let i = 0; i < selChoice.length; i++) { //Loop over all the choices selected in the question
choiceRef = "#" + this.questionId + "-" + selChoice[i] + "-label > span"; // Create a reference for the choices
choiceText = document.querySelector(choiceRef).innerHTML; //Get the value (The actual text displayed)of the choices from the webpage
// Set Embedded Data
if (choiceText.includes("Share")) {
Qualtrics.SurveyEngine.setEmbeddedData("Share", "TRUE");
if (choiceText.includes("Share")) {
Qualtrics.SurveyEngine.setEmbeddedData("Share", "TRUE");
} else
Qualtrics.SurveyEngine.setEmbeddedData("Share", "FALSE");
}
}
}
}
});
```

0 comments on commit 4b08443

Please sign in to comment.