mirror of
https://github.com/VSCodium/vscodium.github.io.git
synced 2025-12-11 14:02:18 -06:00
fix: best-practices
This commit is contained in:
parent
86bf0d30d5
commit
ba22a62763
@ -1,5 +1,8 @@
|
|||||||
html { box-sizing: border-box; }
|
|
||||||
*, *:before, *:after { box-sizing: inherit; }
|
*, *:before, *:after { box-sizing: inherit; }
|
||||||
|
html {
|
||||||
|
box-sizing: border-box;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------*/
|
/* ---------------------------*/
|
||||||
/* ----- Special Styles ----- */
|
/* ----- Special Styles ----- */
|
||||||
@ -52,6 +55,7 @@ pre {
|
|||||||
.highlight { margin:20px 5%; }
|
.highlight { margin:20px 5%; }
|
||||||
|
|
||||||
/* ----- anchors ----- */
|
/* ----- anchors ----- */
|
||||||
|
nav > ul > li > a:focus { box-shadow: none; }
|
||||||
a:focus { box-shadow: 0 0 0 3px {{ site.colors.purple }}cc; }
|
a:focus { box-shadow: 0 0 0 3px {{ site.colors.purple }}cc; }
|
||||||
|
|
||||||
/* ----- base elements ----- */
|
/* ----- base elements ----- */
|
||||||
@ -365,6 +369,13 @@ nav ul li:hover, nav ul li.active {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* reduced motion */
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
html {
|
||||||
|
scroll-behavior: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.intro-text {
|
.intro-text {
|
||||||
margin: 0 0 10px;
|
margin: 0 0 10px;
|
||||||
font-family: "Segoe UI","Helvetica Neue","Helvetica",Arial,sans-serif;
|
font-family: "Segoe UI","Helvetica Neue","Helvetica",Arial,sans-serif;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ If you use Windows and have [Chocolatey](https://chocolatey.org) installed (than
|
|||||||
choco install vscodium
|
choco install vscodium
|
||||||
```
|
```
|
||||||
|
|
||||||
### <a id="install-with-scoop"></a>Install with Scoop (Windows)
|
### <a id="install-with-scoop" href="#install-with-scoop"></a>Install with Scoop (Windows)
|
||||||
If you use Windows and have [Scoop](https://scoop.sh/) installed:
|
If you use Windows and have [Scoop](https://scoop.sh/) installed:
|
||||||
```bash
|
```bash
|
||||||
scoop bucket add extras
|
scoop bucket add extras
|
||||||
|
|||||||
@ -58,6 +58,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
|
||||||
<script src="site.js"></script>
|
<script src="site.js"></script>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
95
site.js
95
site.js
@ -1,96 +1 @@
|
|||||||
[...document.getElementById("install").getElementsByTagName("code")].forEach(x => x.tabIndex = 0);
|
[...document.getElementById("install").getElementsByTagName("code")].forEach(x => x.tabIndex = 0);
|
||||||
|
|
||||||
$.extend($.easing,
|
|
||||||
{
|
|
||||||
def: 'easeOutQuad',
|
|
||||||
easeInOutExpo: function (x, t, b, c, d) {
|
|
||||||
if (t==0) return b;
|
|
||||||
if (t==d) return b+c;
|
|
||||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
||||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(function( $ ) {
|
|
||||||
|
|
||||||
var settings;
|
|
||||||
var disableScrollFn = false;
|
|
||||||
var navItems;
|
|
||||||
var navs = {}, sections = {};
|
|
||||||
|
|
||||||
$.fn.navScroller = function(options) {
|
|
||||||
settings = $.extend({
|
|
||||||
scrollToOffset: 170,
|
|
||||||
scrollSpeed: 800,
|
|
||||||
activateParentNode: true,
|
|
||||||
}, options );
|
|
||||||
navItems = this;
|
|
||||||
|
|
||||||
//attatch click listeners
|
|
||||||
navItems.on('click', function(event){
|
|
||||||
event.preventDefault();
|
|
||||||
var navID = $(this).attr("href").substring(1);
|
|
||||||
disableScrollFn = true;
|
|
||||||
activateNav(navID);
|
|
||||||
populateDestinations(); //recalculate these!
|
|
||||||
$('html,body').animate({scrollTop: sections[navID] - settings.scrollToOffset},
|
|
||||||
settings.scrollSpeed, "easeInOutExpo", function(){
|
|
||||||
disableScrollFn = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
//populate lookup of clicable elements and destination sections
|
|
||||||
populateDestinations(); //should also be run on browser resize, btw
|
|
||||||
|
|
||||||
// setup scroll listener
|
|
||||||
$(document).scroll(function(){
|
|
||||||
if (disableScrollFn) { return; }
|
|
||||||
var page_height = $(window).height();
|
|
||||||
var pos = $(this).scrollTop();
|
|
||||||
for (i in sections) {
|
|
||||||
if ((pos + settings.scrollToOffset >= sections[i]) && sections[i] < pos + page_height){
|
|
||||||
activateNav(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function populateDestinations() {
|
|
||||||
navItems.each(function(){
|
|
||||||
var scrollID = $(this).attr('href').substring(1);
|
|
||||||
navs[scrollID] = (settings.activateParentNode)? this.parentNode : this;
|
|
||||||
sections[scrollID] = $(document.getElementById(scrollID)).offset().top;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function activateNav(navID) {
|
|
||||||
for (nav in navs) { $(navs[nav]).removeClass('active'); }
|
|
||||||
$(navs[navID]).addClass('active');
|
|
||||||
}
|
|
||||||
})( jQuery );
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function (){
|
|
||||||
|
|
||||||
$('nav li a').navScroller();
|
|
||||||
|
|
||||||
//section divider icon click gently scrolls to reveal the section
|
|
||||||
$(".sectiondivider").on('click', function(event) {
|
|
||||||
$('html,body').animate({scrollTop: $(event.target.parentNode).offset().top - 50}, 400, "linear");
|
|
||||||
});
|
|
||||||
|
|
||||||
//links going to other sections nicely scroll
|
|
||||||
$(".container a").each(function(){
|
|
||||||
if ($(this).attr("href").charAt(0) == '#'){
|
|
||||||
$(this).on('click', function(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
var target = $(event.target).closest("a");
|
|
||||||
var targetHight = $(target.attr("href")).offset().top
|
|
||||||
$('html,body').animate({scrollTop: targetHight - 170}, 800, "easeInOutExpo");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user