File tree Expand file tree Collapse file tree 3 files changed +81
-3
lines changed Expand file tree Collapse file tree 3 files changed +81
-3
lines changed Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ NProgress.configure({ parent: "#container" });
238238Colors can be customized using CSS variables.
239239
240240``` css
241- :root {
241+ #nprogress {
242242 --nprogress-color : #29d ;
243243 --nprogress-height : 2px ;
244244 --nprogress-spinner-opacity : 1 ;
@@ -247,6 +247,30 @@ Colors can be customized using CSS variables.
247247}
248248```
249249
250+ ## Customization examples
251+
252+ <summary >
253+ <details >Hiding the spinner</details >
254+
255+ ``` css
256+ #nprogress {
257+ --nprogress-spinner-opacity : 0 ;
258+ }
259+ ```
260+
261+ </summary >
262+
263+ <summary >
264+ <details >Changing the color</details >
265+
266+ ``` css
267+ #nprogress {
268+ --nprogress-color : #29d ;
269+ }
270+ ```
271+
272+ </summary >
273+
250274## Resources
251275
252276- [ New UI Pattern: Website Loading Bars] ( http://www.usabilitypost.com/2013/08/19/new-ui-pattern-website-loading-bars/ ) (usabilitypost.com)
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="utf-8 " />
5+ < script src ="dist/nprogress.umd.js "> </ script >
6+ < link rel ="stylesheet " href ="css/nprogress.css ">
7+ < style data-js-dynamic-style > </ style >
8+ </ head >
9+ < body >
10+ < div class ="actions ">
11+ < button data-js-start > Start</ button >
12+ < button data-js-done > Done</ button >
13+ < button data-js-style-0 > Reset</ button >
14+ < button data-js-style-1 > Style 1</ button >
15+ </ div >
16+
17+ < script >
18+ function qs ( selector ) {
19+ return document . querySelector ( selector ) ;
20+ }
21+
22+ console . log ( 'NProgress demo' )
23+
24+ qs ( "[data-js-start]" ) . addEventListener ( "click" , ( ) => {
25+ NProgress . start ( ) ;
26+ } ) ;
27+
28+ qs ( "[data-js-done]" ) . addEventListener ( "click" , ( ) => {
29+ NProgress . done ( ) ;
30+ } ) ;
31+
32+ qs ( "[data-js-style-0]" ) . addEventListener ( "click" , ( ) => {
33+ qs ( "[data-js-dynamic-style]" ) . innerHTML = "" ;
34+ } ) ;
35+
36+ qs ( "[data-js-style-1]" ) . addEventListener ( "click" , ( ) => {
37+ qs ( "[data-js-dynamic-style]" ) . innerHTML = `
38+ #nprogress {
39+ --nprogress-color: #f00;
40+ --nprogress-height: 1px;
41+ --nprogress-spinner-size: 32px;
42+ --nprogress-spinner-stroke-width: 3px;
43+ }
44+ ` ;
45+ } ) ;
46+ </ script >
47+ </ body >
48+ </ html >
Original file line number Diff line number Diff line change 1616 "microbundle" : " ^0.11.0" ,
1717 "prettier" : " ^2.0.4"
1818 },
19+ "files" : [
20+ " demo.html" ,
21+ " dist" ,
22+ " css" ,
23+ " src"
24+ ],
1925 "homepage" : " https://github.com/rstacruz/nprogress#readme" ,
2026 "keywords" : [
2127 " bar" ,
3541 "url" : " git+https://github.com/rstacruz/nprogress.git"
3642 },
3743 "scripts" : {
38- "build" : " microbundle" ,
39- "dev" : " microbundle watch" ,
44+ "build" : " microbundle --name NProgress " ,
45+ "dev" : " npm run build -- watch" ,
4046 "format" : " prettier --write 'src/*.js' 'css/*.{css,scss}'" ,
4147 "prettier:check" : " prettier --check 'src/*.js' 'css/*.{css,scss}'" ,
4248 "test" : " jest"
You can’t perform that action at this time.
0 commit comments