Skip to content

Commit 5345f96

Browse files
committed
Update docs.
1 parent 6f8663b commit 5345f96

3 files changed

Lines changed: 33 additions & 12 deletions

File tree

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
<body>
1010
<header class='page-header'>
1111
<h1>NProgress<i>.js</i></h1>
12+
<p>Small, nano-scopic progress bar. Featuring realistic trickle animations to convince your users that something is happening!</p>
1213
</header>
1314

14-
<div class='controls'>
15+
<div class='controls fade out'>
1516
<p>
1617
<button class='button play' id='b-0'></button>
1718
<i>NProgress</i><b>.start()</b>
@@ -43,7 +44,7 @@ <h1>NProgress<i>.js</i></h1>
4344

4445
<script>
4546
NProgress.start();
46-
setTimeout(function() { NProgress.done(); }, 1000);
47+
setTimeout(function() { NProgress.done(); $('.controls').removeClass('out'); }, 1000);
4748

4849
$("#b-0").click(function() { NProgress.start(); });
4950
$("#b-40").click(function() { NProgress.set(0.4); });

nprogress.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
minimum: 0.05,
1010
easing: 'ease',
1111
speed: 300,
12+
trickleSpeed: 0.008,
1213
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner"><div class="spinner-icon"></div></div>'
1314
};
1415

@@ -81,11 +82,6 @@
8182
* NProgress.start();
8283
*
8384
*/
84-
NProgress.start = function() {
85-
if (!NProgress.status) NProgress.set(0);
86-
return this;
87-
};
88-
8985
NProgress.start = function() {
9086
if (!NProgress.status) NProgress.set(0);
9187

@@ -97,7 +93,7 @@
9793
}, Settings.speed * 4);
9894
};
9995

100-
work();
96+
if (Settings.trickleSpeed) work();
10197

10298
return this;
10399
};
@@ -140,7 +136,7 @@
140136
};
141137

142138
NProgress.trickle = function() {
143-
return NProgress.inc(Math.random() * 0.002);
139+
return NProgress.inc(Math.random() * Settings.trickleSpeed);
144140
};
145141

146142
/**

support/style.css

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ body, td, input, textarea {
1515
-webkit-font-smoothing: antialiased;
1616
}
1717

18+
.fade {
19+
transition: all 300ms linear 700ms;
20+
opacity: 1;
21+
}
22+
23+
.fade.out {
24+
opacity: 0;
25+
}
26+
1827
button {
1928
margin: 0;
2029
padding: 0;
@@ -74,13 +83,27 @@ button {
7483
font-size: 0.9em;
7584
}
7685

86+
.page-header {
87+
margin: 1.5em auto;
88+
text-align: center;
89+
max-width: 400px;
90+
padding: 0 20px;
91+
}
92+
7793
.page-header h1 {
7894
font-size: 2.0em;
7995
text-align: center;
8096
font-weight: 100;
8197
line-height: 1.3;
8298
color: #333;
83-
margin: 1em 0 1em 0;
99+
margin: 0;
100+
}
101+
102+
.page-header p {
103+
line-height: 1.4;
104+
font-size: 1.1em;
105+
font-style: italic;
106+
color: #888;
84107
}
85108

86109
.page-header h1 i {
@@ -91,7 +114,8 @@ button {
91114

92115
@media (min-width: 480px) {
93116
.page-header h1 {
94-
font-size: 3em;
95-
margin: 1.5em 0 1.5em 0;
117+
font-size: 3em; }
118+
.page-header {
119+
margin: 3.5em auto;
96120
}
97121
}

0 commit comments

Comments
 (0)