Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Expanding a collapsible set should scroll you to the top of it's contents #2167

@InvisibleBacon

Description

@InvisibleBacon

If you have more than a page's height worth of contents in your first collapsible container, and you scroll down to the second set to expand, the browser's scroll position does not change, leaving you in the middle of the second container's contents. I fixed this on our site by scrolling to the top of the clicked header if it is off the top of the page after an expansion. Here's the code I use:

$("div.ui-collapsible-set").live("expand", function(e) {
    var top = $(e.target).offset().top;
        if ($(window).scrollTop() > top)
            $(window).scrollTop(top);
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions