Skip to content

Commit

Permalink
fix: move scripts to end of page
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafaei2002 committed May 14, 2024
1 parent 36c97e3 commit a854807
Showing 1 changed file with 48 additions and 47 deletions.
95 changes: 48 additions & 47 deletions docs_theme/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,53 +127,7 @@
</p>
</footer>

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script async src="https://fund.django-rest-framework.org/sidebar_include.js"></script>
<script src="{{ 'js/jquery-1.8.1-min.js'|url }}"></script>
<script src="{{ 'js/prettify-1.0.js'|url }}"></script>
<script src="{{ 'js/bootstrap-2.1.1-min.js'|url }}"></script>
<script src="{{ 'js/theme.js'|url }}"></script> -->

<script>
var base_url = "{{ base_url }}";
</script>

<script src="{{ 'js/bootstrap5.bundle.js'|url }}"></script>

{% for path in config.extra_javascript %}
<script src="{{ path|url }}" defer></script>
{% endfor %}

<script>
var shiftWindow = function () {
scrollBy(0, -50);
};

if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);

$(".dropdown-menu").on("click touchstart", function (event) {
event.stopPropagation();
});

// Dynamically force sidenav/dropdown to no higher than browser window
$(".side-nav, .dropdown-menu").css(
"max-height",
window.innerHeight - 130
);

$(function () {
$(window).resize(function () {
$(".side-nav, .dropdown-menu").css(
"max-height",
window.innerHeight - 130
);
});
});
</script>

<!-- Search Modal Start -->
<div
class="modal fade"
id="mkdocs_search_modal"
Expand Down Expand Up @@ -224,5 +178,52 @@ <h3 class="modal-title fs-5" id="search_modal_label">
</div>
</div>
<!-- Modal End -->

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script async src="https://fund.django-rest-framework.org/sidebar_include.js"></script>
<script src="{{ 'js/jquery-1.8.1-min.js'|url }}"></script>
<script src="{{ 'js/prettify-1.0.js'|url }}"></script>
<script src="{{ 'js/bootstrap-2.1.1-min.js'|url }}"></script>
<script src="{{ 'js/theme.js'|url }}"></script> -->

<script>
var base_url = "{{ base_url }}";
</script>

<script src="{{ 'js/bootstrap5.bundle.js'|url }}"></script>

{% for path in config.extra_javascript %}
<script src="{{ path|url }}" defer></script>
{% endfor %}

<script>
var shiftWindow = function () {
scrollBy(0, -50);
};

if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);

$(".dropdown-menu").on("click touchstart", function (event) {
event.stopPropagation();
});

// Dynamically force sidenav/dropdown to no higher than browser window
$(".side-nav, .dropdown-menu").css(
"max-height",
window.innerHeight - 130
);

$(function () {
$(window).resize(function () {
$(".side-nav, .dropdown-menu").css(
"max-height",
window.innerHeight - 130
);
});
});
</script>
</body>
</html>

0 comments on commit a854807

Please sign in to comment.