PageSourceSearch

https://dev.rutoken.ru/includes/js/third-party/jquery.simpleScrollTo-1.0.js

js rutoken.ru collected 2026-09-24 08:59:27 UTC 919 bytes, 21 lines download raw bytes

1/**
2 * Simple scroll-to jQuery plugin.
3 * Written by Atlassian, October 2009.
4 *
5 * Typical usage: $("#container").simpleScrollTo($("#container > .some-item"))
6 *
7 * The container must be the nearest ancestor of the item with "position: relative" or "position: absolute".
8 * This is the only way that the item's position can be calculated relative to it.
9 */
10jQuery.fn.simpleScrollTo = function (element) {
11    var $ = jQuery;
12    var container = $(this[0]);
13    var topOffset = $(element).position().top;
14    var bottomOffset = topOffset + $(element).outerHeight() - container.outerHeight();
15    if (topOffset < 0) { // top of element is above the top of the container
16        container.scrollTop(container.scrollTop() + topOffset);
17    } else if (bottomOffset > 0) { // bottom of element is below the bottom of the container
18        container.scrollTop(container.scrollTop() + bottomOffset);
19    }
20    return this;
21};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.