config.navigation.scroll_to_top - Initialization - Items API

Items API Initialization

scroll_to_top

Automatically scrolls the browser window so that it is aligned with the top of the assessment player when the learner navigates to another Item.

You would want to specify this option to improve the learner experience with Items that contain multiple Questions, requiring the learner to scroll down to see the content. Then when the learner navigates to another Item, their viewport will scroll to the top of the assessment player.

Examples

// Scrolls the host page to the assessment player when the current Item has changed
var initializationOptions = {
    "config": {
        "navigation": {
            "scroll_to_top": true
        }
    }
};

// Scroll above the assessment player by 20 pixels when the current Item has changed
var initializationOptions = {
    "config": {
        "navigation": {
            "scroll_to_top": {
                "offset_top": -20
            }
        }
    }
};

Values

Attribute path config.navigation.scroll_to_top

Default true

  • Type boolean

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

    Set to false to disable the auto-scrolling 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.

Related articles

  • The scroll_to_test initialization option, which brings the assessment player into view by automatically scrolling the browser window when the session starts.
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.