mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-07 21:37:46 +08:00
docs: optimize language switch functionality and styles for better responsiveness
This commit is contained in:
@@ -1,14 +1,26 @@
|
||||
(function () {
|
||||
function getDockHost() {
|
||||
if (window.matchMedia && window.matchMedia("(max-width: 768px)").matches) {
|
||||
return document.body;
|
||||
}
|
||||
|
||||
return document.querySelector(".wy-nav-side") || document.body;
|
||||
}
|
||||
|
||||
function ensureDock() {
|
||||
var dock = document.querySelector("[data-docs-switch-dock]");
|
||||
if (dock) {
|
||||
return dock;
|
||||
var host = getDockHost();
|
||||
|
||||
if (!dock) {
|
||||
dock = document.createElement("div");
|
||||
dock.className = "docs-floating-switches";
|
||||
dock.setAttribute("data-docs-switch-dock", "");
|
||||
}
|
||||
|
||||
if (dock.parentNode !== host) {
|
||||
host.appendChild(dock);
|
||||
}
|
||||
|
||||
dock = document.createElement("div");
|
||||
dock.className = "docs-floating-switches";
|
||||
dock.setAttribute("data-docs-switch-dock", "");
|
||||
document.body.appendChild(dock);
|
||||
return dock;
|
||||
}
|
||||
|
||||
@@ -117,7 +129,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
ensureDock().appendChild(widget);
|
||||
function mountWidget() {
|
||||
ensureDock().appendChild(widget);
|
||||
}
|
||||
|
||||
mountWidget();
|
||||
window.addEventListener("resize", mountWidget, { passive: true });
|
||||
|
||||
var locationInfo = parseLocation(config);
|
||||
if (!locationInfo) {
|
||||
|
||||
Reference in New Issue
Block a user