Class ScrollToTop


public class ScrollToTop extends JavaScriptCommand
Command that scrolls a parent container so that the specified child element is at the top.

This command invokes the client-side scrollToTop() function to position the target element at the top of its scrollable parent container.

  • Constructor Details

    • ScrollToTop

      public ScrollToTop(Element parent, Element element)
      Creates a ScrollToTop command for the specified parent and child elements.
      Parameters:
      parent - the scrollable parent container element
      element - the child element to scroll to the top of the parent
    • ScrollToTop

      public ScrollToTop(String parentId, String elementId)
      Creates a ScrollToTop command using element IDs.
      Parameters:
      parentId - the ID of the scrollable parent container
      elementId - the ID of the child element to scroll to the top