Initialization Option Items API

scroll_to_test

Brings the assessment player into view by automatically scrolling the browser window so that it is aligned with the top of the assessment player when the session starts.

You would want to specify this option for long pages where the learner may have scrolled past the assessment player, moving it out of view, for example.

Important For this option to take effect, the focus_on_player initialization option must be set to false. See the caveats section for more information.

Examples

// Scrolls the host page to the assessment player to bring it into view
var initializationOptions = {
    "config": {
        "navigation": {
            "scroll_to_test": true
        },
        "configuration": {
            "focus_on_player": false
        }
    }
};

// Scroll above the assessment player by 20 pixels
var initializationOptions = {
    "config": {
        "navigation": {
            "scroll_to_test": {
                "offset_top": -20
            }
        },
        "configuration": {
            "focus_on_player": false
        }
    }
};

Values

Request object key config.navigation.scroll_to_test

Default: true

This option can be initialized as one of the following types: boolean object.

  • Type boolean

    Set to true to scroll to the top of the assessment player without any additional offset.

    Set to false to disable this functionality.

  • Type object
    • offset_top number

      Scroll to the top of the assessment player with an additional offset as a pixel value.

      This setting is useful when you have additional content to display that is above the assessment player.

      Example: 10

Caveats

The scroll_to_test option does not work when combined with focus_on_player. The focus_on_player initialization option is set to true by default and will take priority over scroll_to_test. The focus_on_player option will set the browser's focus to the start button element, which will result in the page being scrolled automatically so that the start button is visible on the screen.

Related articles

  • The scroll_to_top initialization option, which brings the assessment player into view by automatically scrolling the browser window when the learner navigates to a different Item.
  • The focus_on_player initialization option, which sets the browser focus to the start button element on the intro page when the assessment player has loaded.
Was this article helpful?