File tree 3 files changed +66
-6
lines changed
3 files changed +66
-6
lines changed Original file line number Diff line number Diff line change 1
1
var baseURL = "https://raw.githubusercontent.com/theanam/css-only-loaders/master/spinners/" ;
2
-
3
-
2
+ var base_css = "" ;
4
3
function getDefination ( cssClass , callback ) {
5
4
$ . get ( `${ baseURL } /${ cssClass } /${ cssClass } .css` )
6
5
. then ( data => {
@@ -11,11 +10,35 @@ function getDefination(cssClass,callback){
11
10
} ) ;
12
11
}
13
12
13
+ function prepareSourceCode ( data ) {
14
+ console . log ( data ) ;
15
+ $ ( ".sourceholder" ) . css ( "display" , "flex" ) ;
16
+ $ ( ".actual-code" ) . text ( base_css + "\n\n" + data ) ;
17
+ }
18
+
14
19
$ ( ".spinner,.ripple" ) . on ( "click" , function ( e ) {
15
20
var classes = $ ( this ) . attr ( "class" ) ;
16
21
var defName = classes . split ( " " ) [ 1 ] ;
17
22
if ( ! defName ) return console . log ( "Defination class missing" ) ;
18
23
getDefination ( defName , function ( data ) {
19
- console . log ( data ) ;
24
+ prepareSourceCode ( data ) ;
20
25
} ) ;
26
+ } ) ;
27
+
28
+ $ ( ".source" ) . on ( "click" , function ( e ) {
29
+ e . stopPropagation ( ) ;
30
+ } ) ;
31
+
32
+ $ ( ".sourceholder" ) . on ( "click" , function ( ) {
33
+ $ ( this ) . css ( "display" , "none" ) ;
34
+ } ) ;
35
+
36
+ $ ( function ( ) {
37
+ $ . get ( `${ baseURL } /vars.css` )
38
+ . then ( data => {
39
+ base_css = data ;
40
+ } )
41
+ . catch ( e => {
42
+ console . log ( "Failed to load base CSS" ) ;
43
+ } )
21
44
} )
Original file line number Diff line number Diff line change 1
1
.spinner , .ripple {
2
2
display : inline-block;
3
3
margin : 100px ;
4
+ cursor : pointer;
5
+ background : # fff ;
6
+ }
7
+
8
+ .sourceholder {
9
+ width : 100% ;
10
+ height : 100% ;
11
+ left : 0px ;
12
+ top : 0px ;
13
+ position : fixed;
14
+ background : rgba (0 , 0 , 0 , 0.2 );
15
+ display : none;
16
+ z-index : 10000 ;
17
+ align-items : center;
18
+ justify-content : center;
19
+ }
20
+ .source {
21
+ width : 70vw ;
22
+ height : 70vh ;
23
+ background : # 222 ;
24
+ padding : 20px ;
25
+ z-index : 30000 ;
26
+ border-radius : 4px ;
27
+ overflow : scroll;
28
+ }
29
+ .actual-code {
30
+ z-index : 800000000 ;
31
+ font-size : 12px ;
32
+ color : # fff ;
33
+ display : block;
34
+ overflow : scroll;
4
35
}
Original file line number Diff line number Diff line change 6
6
< meta http-equiv ="X-UA-Compatible " content ="ie=edge ">
7
7
< title > CSS Only Loaders</ title >
8
8
< link rel ="stylesheet " href ="homepage-assets/style.css ">
9
- < link rel ="stylesheet " href ="homepage-assets/prism.css ">
10
9
<!-- spinners -->
11
10
< link rel ="stylesheet " href ="spinners/vars.css ">
12
11
< link rel ="stylesheet " href ="spinners/circle/circle.css ">
17
16
< link rel ="stylesheet " href ="spinners/color-pulse-ball/color-pulse-ball.css ">
18
17
</ head >
19
18
< body >
20
- < h1 > This is just a sample page, Homepage is under construction</ h1 >
19
+ < h1 > Click on the Spinners to see CSS Styles</ h1 >
20
+ < p >
21
+ Homepage Under construction
22
+ </ p >
21
23
< div class ="spinner circle "> </ div >
22
24
< div class ="spinner blasting-circle "> </ div >
23
25
< div class ="spinner rotating-plane "> </ div >
@@ -32,8 +34,12 @@ <h1>This is just a sample page, Homepage is under construction</h1>
32
34
All the attributes are in the < code > /spinners/values.css</ code > file. you need to include that file before the spinner CSS file.
33
35
see the source code to this file < code > /index.html</ code > for example usage.
34
36
</ p >
37
+ < div class ="sourceholder ">
38
+ < pre class ="source ">
39
+ < code class ="actual-code "> </ code >
40
+ </ pre >
41
+ </ div >
35
42
< script src ="homepage-assets/jquery-3.4.1.min.js "> </ script >
36
- < script src ="homepage-assets/prism.js "> </ script >
37
43
< script src ="homepage-assets/homepage.js "> </ script >
38
44
</ body >
39
45
</ html >
You can’t perform that action at this time.
0 commit comments