mirror of
https://github.com/picocss/pico.git
synced 2025-04-20 08:45:06 -04:00
Improvements
- Small adjustments for table striping - Consitent shadows for Dark mode - Bigger Checkboxes, Radios and Switches - Disable transitions for Checkboxes, Radios and Details - Simplier .grids in docs - Replace .js for internal scroll with CSS - Better aside adjustment in .js - Many small improvements in docs
This commit is contained in:
parent
772425bf2f
commit
c8ddb87647
26 changed files with 209 additions and 288 deletions
|
@ -1,5 +1,4 @@
|
|||
// @prepros-append src/aside.js
|
||||
// @prepros-append src/theme-switcher.js
|
||||
// @prepros-append src/internal-scroll.js
|
||||
// @prepros-append src/grid.js
|
||||
// @prepros-append src/color-picker.js
|
||||
|
|
2
docs/js/pico.docs.min.js
vendored
2
docs/js/pico.docs.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -8,11 +8,12 @@
|
|||
(function() {
|
||||
|
||||
// Close details if aside > nav have a scrollbar
|
||||
var navWidth = document.querySelector('aside nav').clientWidth;
|
||||
if (navWidth < 200) {
|
||||
var asideDetails = document.querySelectorAll("aside details");
|
||||
for (var i = 1; i < asideDetails.length; i++) {
|
||||
asideDetails[i].removeAttribute("open");
|
||||
var nav = document.querySelector("aside nav");
|
||||
var navDetails = document.querySelectorAll("aside details");
|
||||
|
||||
if (nav.clientHeight < nav.scrollHeight) {
|
||||
for (var i = 1; i < navDetails.length; i++) {
|
||||
navDetails[i].removeAttribute("open");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*/
|
||||
|
||||
var colors = {
|
||||
list: 'json/material-colors.json',
|
||||
target: '#customization h5', // Buttons inserted after target
|
||||
selectorButton: '#customization button[data-color]', // Button selector in Dom
|
||||
selectorTheme: '#customization', // Theme selector in Dom
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
/*!
|
||||
* Internal Scroll
|
||||
*
|
||||
* Pico.css - https://picocss.com
|
||||
* Copyright 2019 - Licensed under MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
|
||||
smoothInternalClicks(
|
||||
document.querySelectorAll('a:not([href^="https://picocss.com"])')
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Smooth internal clicks
|
||||
*
|
||||
* @param {querySelector} links
|
||||
*/
|
||||
|
||||
function smoothInternalClicks(links) {
|
||||
for (var i=0; i<links.length; i++) {
|
||||
if (links[i].href.indexOf('#') != -1) {
|
||||
links[i].addEventListener('click', function(event) {
|
||||
internalClick(event.target);
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal Click
|
||||
*
|
||||
* @param {element} link
|
||||
*/
|
||||
|
||||
function internalClick(link) {
|
||||
event.preventDefault();
|
||||
var anchor = link.href.split("#");
|
||||
if (anchor[1] != '') {
|
||||
anchor = setAnchor(anchor[1]);
|
||||
anchor = document.getElementById(anchor);
|
||||
scrollToAnchor(anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set anchor
|
||||
* Change anchor if needed
|
||||
* @param {string} anchor
|
||||
*/
|
||||
|
||||
function setAnchor(anchor) {
|
||||
mobile = window.matchMedia("(max-width: 991.99px)");
|
||||
if (!mobile.matches) {
|
||||
if (anchor == "docs") {
|
||||
anchor = "start";
|
||||
}
|
||||
}
|
||||
return anchor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Scroll to anchor
|
||||
*
|
||||
* @param {element} anchor
|
||||
*/
|
||||
|
||||
function scrollToAnchor(anchor) {
|
||||
var top = distanceToTop(anchor);
|
||||
window.scrollBy({ top: top, left: 0, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get distance to top
|
||||
*
|
||||
* @param {element} target
|
||||
*/
|
||||
|
||||
function distanceToTop(target) {
|
||||
return Math.floor(target.getBoundingClientRect().top);
|
||||
}
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue