浏览代码

fixed scrolling to anchor tag

Rodja Trappe 2 年之前
父节点
当前提交
db831c038f
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      api_docs_and_examples.py

+ 3 - 0
api_docs_and_examples.py

@@ -665,3 +665,6 @@ The asynchronous function will only return after receiving the result.
 
         ui.button('run JavaScript', on_click=run_javascript)
         ui.button('await JavaScript', on_click=await_javascript)
+
+    # NOTE because the docs are added after inital page load, we need to manually trigger the jump tho the anchor
+    await ui.run_javascript('parts = document.URL.split("#"); window.location.hash = "#"; setTimeout(function(){ window.location.hash = "#" + (parts.length > 1) ? parts[1] : null; }, 100);')