Browse Source

fixed scrolling to anchor tag

Rodja Trappe 2 years ago
parent
commit
db831c038f
1 changed files with 3 additions and 0 deletions
  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);')