mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 05:20:12 +03:00
Setup scrollspy
This commit is contained in:
parent
b03dfe4a4d
commit
9ae4d4fc61
|
@ -1,5 +1,6 @@
|
||||||
body {
|
body {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
position: 'relative';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toggle Styles */
|
/* Toggle Styles */
|
||||||
|
@ -17,6 +18,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-wrapper {
|
#sidebar-wrapper {
|
||||||
|
background: #E8EAEF;
|
||||||
|
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 250px;
|
left: 250px;
|
||||||
|
@ -24,7 +27,6 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin-left: -250px;
|
margin-left: -250px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
background: #F7F7F9;
|
|
||||||
-webkit-transition: all 0.5s ease;
|
-webkit-transition: all 0.5s ease;
|
||||||
-moz-transition: all 0.5s ease;
|
-moz-transition: all 0.5s ease;
|
||||||
-o-transition: all 0.5s ease;
|
-o-transition: all 0.5s ease;
|
||||||
|
@ -65,10 +67,10 @@
|
||||||
text-indent: 30px;
|
text-indent: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.sidebar-nav li a {
|
.sidebar-nav li a {
|
||||||
display: block;
|
display: block;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
|
@ -77,14 +79,21 @@
|
||||||
padding: 8px 15px;
|
padding: 8px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-nav li a:hover {
|
.sidebar-nav li.active > a {
|
||||||
text-decoration: none;
|
background: none;
|
||||||
background: rgba(255,255,255,0.9);
|
|
||||||
border: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-nav li.active > a:hover {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-nav > li.active > .nav > li.active > a,
|
||||||
|
.sidebar-nav li a:hover,
|
||||||
.sidebar-nav li a:active,
|
.sidebar-nav li a:active,
|
||||||
.sidebar-nav li a:focus {
|
.sidebar-nav li a:focus {
|
||||||
|
text-decoration: none;
|
||||||
|
background: white;
|
||||||
|
border: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<script src="https://unpkg.com/coreapi@0.0.18/dist/coreapi.js"></script>
|
<script src="https://unpkg.com/coreapi@0.0.18/dist/coreapi.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body data-spy="scroll" data-target="#sidebar-nav" data-offset="50">
|
||||||
|
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
{% include "rest_framework/docs/sidebar.html" %}
|
{% include "rest_framework/docs/sidebar.html" %}
|
||||||
|
@ -76,8 +76,6 @@
|
||||||
const doc = codec.decode(schema, {preloaded: true})
|
const doc = codec.decode(schema, {preloaded: true})
|
||||||
const client = new coreapi.Client(null, null, csrf)
|
const client = new coreapi.Client(null, null, csrf)
|
||||||
|
|
||||||
$('body').scrollspy({ target: '#toc' })
|
|
||||||
|
|
||||||
// Language Control
|
// Language Control
|
||||||
$('.language-control li a').click(function (event) {
|
$('.language-control li a').click(function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
@ -15,33 +15,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <ul class="nav navbar-nav navbar-right">
|
<ul id="sidebar-nav" class="nav nav-pills nav-stacked sidebar-nav">
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span>shell</span> <b class="caret"></b></a>
|
|
||||||
<ul class="dropdown-menu language-control">
|
|
||||||
<li class="active"><a href="#" data-language="shell">shell</a></li>
|
|
||||||
<li><a href="#" data-language="javascript">javascript</a></li>
|
|
||||||
<li><a href="#" data-language="python">python</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul> -->
|
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-stacked sidebar-nav">
|
|
||||||
|
|
||||||
{% for section_key, section in document.data.items %}
|
{% for section_key, section in document.data.items %}
|
||||||
<li>
|
<li role="navigation">
|
||||||
<a href="#{{ section_key }}">{{ section_key }}</a>
|
<a href="#{{ section_key }}">{{ section_key }}</a>
|
||||||
|
|
||||||
<!-- TOC -->
|
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-stacked">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
{% for link_key, link in section.links.items %}
|
{% for link_key, link in section.links.items %}
|
||||||
<li><a href="#{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li>
|
<li role="navigation"><a href="#{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- /#sidebar-wrapper -->
|
<!-- /#sidebar-wrapper -->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user