mirror of
https://github.com/picocss/pico.git
synced 2025-04-21 09:06:14 -04:00
Add scripts to build and watch files
This commit is contained in:
parent
2986278b15
commit
8e028956e9
23 changed files with 13439 additions and 1660 deletions
7
docs/js/src/most-visible.min.js
vendored
7
docs/js/src/most-visible.min.js
vendored
|
@ -1,7 +0,0 @@
|
|||
/**
|
||||
* Most Visible v1.5.0
|
||||
*
|
||||
* @author Andy Palmer <andy@andypalmer.me>
|
||||
* @license MIT
|
||||
*/
|
||||
!function(e,t){"function"==typeof define&&define.amd?define([],function(){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(e):e.mostVisible=t(e)}("undefined"!=typeof self?self:this,function(e){"use strict";function i(e,t){if(!(this instanceof i))return new i(e,t).getMostVisible();"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=e,this.options=function(e){for(var t=1;t<arguments.length;t++)for(var i in arguments[t])e[i]=arguments[t][i];return e}({},i.defaults,t)}return i.defaults={percentage:!1,offset:0},i.prototype={getMostVisible:function(){var n=this,o=document.documentElement.clientHeight;return Array.prototype.reduce.call(this.elements,function(e,t){var i=n.getVisibleHeight(t,o);return i>e[0]?[i,t]:e},[0,null])[1]},getVisibleHeight:function(e,t){var i=e.getBoundingClientRect(),n=i.top-this.options.offset,o=i.bottom-this.options.offset,s=i.bottom-i.top,r=0<=n&&n<t,f=0<o&&o<t,u=0;if(r&&f)u=s;else if(r)u=t-i.top;else if(f)u=o;else if(t<s&&n<0){var l=Math.abs(n);l<s&&(u=s-l)}return this.options.percentage?u/s*100:u}},i.makeJQueryPlugin=function(e){e&&(e.fn.mostVisible=function(e){var t=new i(this.get(),e);return this.filter(t.getMostVisible())})},i.makeJQueryPlugin(e.jQuery),i});
|
|
@ -11,7 +11,6 @@
|
|||
export const scrollspy = {
|
||||
|
||||
// Config
|
||||
mostVisible: null,
|
||||
minWidth: '992px',
|
||||
interval: 75,
|
||||
targets: {
|
||||
|
@ -22,10 +21,7 @@ export const scrollspy = {
|
|||
|
||||
|
||||
// Init
|
||||
init(mostVisible) {
|
||||
if (this.mostVisible == null) {
|
||||
this.mostVisible = mostVisible;
|
||||
}
|
||||
init() {
|
||||
if (window.matchMedia('(min-width: ' + this.minWidth + ')').matches) {
|
||||
this.setActiveNav();
|
||||
this.scrollStop();
|
||||
|
@ -37,7 +33,7 @@ export const scrollspy = {
|
|||
setActiveNav() {
|
||||
|
||||
// Get active section
|
||||
let currentSection = this.mostVisible(this.targets.sections).getAttribute('id');
|
||||
let currentSection = mostVisible(this.targets.sections).getAttribute('id');
|
||||
|
||||
// Remove all active states
|
||||
let links = document.querySelectorAll(this.targets.nav + ' a.' + this.targets.active);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue