Download Fore_End/cpcn2/node_modules/element-ui/lib/utils/scroll-into-view.js from zxy0307/JavaWeb: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/cpcn2/node_modules/element-ui/lib/utils/scroll-into-view.js
- Command line
-
hf download hf://zxy0307/JavaWeb/Fore_End/cpcn2/node_modules/element-ui/lib/utils/scroll-into-view.js
-
curl -L -o scroll-into-view.js https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/cpcn2/node_modules/element-ui/lib/utils/scroll-into-view.js
1.05 kB
| ; | |
| exports.__esModule = true; | |
| exports.default = scrollIntoView; | |
| var _vue = require('vue'); | |
| var _vue2 = _interopRequireDefault(_vue); | |
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
| function scrollIntoView(container, selected) { | |
| if (_vue2.default.prototype.$isServer) return; | |
| if (!selected) { | |
| container.scrollTop = 0; | |
| return; | |
| } | |
| var offsetParents = []; | |
| var pointer = selected.offsetParent; | |
| while (pointer && container !== pointer && container.contains(pointer)) { | |
| offsetParents.push(pointer); | |
| pointer = pointer.offsetParent; | |
| } | |
| var top = selected.offsetTop + offsetParents.reduce(function (prev, curr) { | |
| return prev + curr.offsetTop; | |
| }, 0); | |
| var bottom = top + selected.offsetHeight; | |
| var viewRectTop = container.scrollTop; | |
| var viewRectBottom = viewRectTop + container.clientHeight; | |
| if (top < viewRectTop) { | |
| container.scrollTop = top; | |
| } else if (bottom > viewRectBottom) { | |
| container.scrollTop = bottom - container.clientHeight; | |
| } | |
| } |