mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-05-10 14:58:27 +00:00
update docs and style
This commit is contained in:
parent
7c6d0e8c34
commit
3599a71af5
@ -690,6 +690,7 @@ AnyProxy.utils.systemProxyMgr.disableGlobalProxy();</code></pre></li>
|
|||||||
|
|
||||||
<script src="//cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script>
|
<script src="//cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
window.onload = function(){
|
||||||
var itemList = [];
|
var itemList = [];
|
||||||
var targetMap = {};
|
var targetMap = {};
|
||||||
$("[id]", ".main-content").map(function (index, heading) {
|
$("[id]", ".main-content").map(function (index, heading) {
|
||||||
@ -707,20 +708,17 @@ AnyProxy.utils.systemProxyMgr.disableGlobalProxy();</code></pre></li>
|
|||||||
var updateTocActive = function (e) {
|
var updateTocActive = function (e) {
|
||||||
var windowHeight = window.innerHeight;
|
var windowHeight = window.innerHeight;
|
||||||
//find the first item to match
|
//find the first item to match
|
||||||
var scrollY = window.scrollY;
|
var scrollYThres = window.scrollY + 200;
|
||||||
var target;
|
var target;
|
||||||
if (scrollY < 100) {
|
if (scrollYThres < 100) {
|
||||||
target = itemList[0].tocItem;
|
target = itemList[0].tocItem;
|
||||||
} else {
|
} else {
|
||||||
itemList.forEach(function (item, index) {
|
itemList.forEach(function (item, index) {
|
||||||
if (target) return;
|
if (target) return;
|
||||||
|
if (index > 0) {
|
||||||
if (index < itemList.length - 1) {
|
if (item.top >= scrollYThres) {
|
||||||
if (item.top <= scrollY + windowHeight / 2 && itemList[index + 1].top > scrollY + windowHeight / 2) {
|
target = itemList[index - 1].tocItem;
|
||||||
target = item.tocItem;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
target = item.tocItem;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -731,6 +729,7 @@ AnyProxy.utils.systemProxyMgr.disableGlobalProxy();</code></pre></li>
|
|||||||
|
|
||||||
window.onscroll = updateTocActive;
|
window.onscroll = updateTocActive;
|
||||||
updateTocActive();
|
updateTocActive();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user