File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 6
6
< title > Alan</ title >
7
7
< script src ="../js/jquery.js " type ="text/javascript "> </ script >
8
8
< script type ="text/javascript ">
9
+ // setup the hex colours to be used in five different scroll areas
9
10
var
10
11
one = "#10e88a" ,
11
12
two = "#7f3995" ,
12
13
three = "#0d78e7" ,
13
14
four = "#f88f18" ,
14
15
five = "#bb6774" ;
15
16
17
+ // this function will fire on user scrolling or touching and dragging (for mobile)
16
18
$ ( window ) . on ( "scroll touchmove" , function ( ) {
19
+
20
+ // these statements give the body a new CSS data-color if
21
+ // the scrollbar is greater than the elements position on page
22
+ // we target each <article> using it's id - #one for example
17
23
if ( $ ( document ) . scrollTop ( ) >= $ ( "#one" ) . position ( ) . top ) {
18
24
$ ( 'body' ) . css ( 'background' , $ ( "#one" ) . attr ( "data-color" ) ) ;
19
-
20
25
} ;
21
26
if ( $ ( document ) . scrollTop ( ) > $ ( "#two" ) . position ( ) . top ) {
22
27
$ ( 'body' ) . css ( 'background' , $ ( "#two" ) . attr ( "data-color" ) )
23
28
} ;
24
29
if ( $ ( document ) . scrollTop ( ) > $ ( "#three" ) . position ( ) . top ) {
25
-
26
30
$ ( 'body' ) . css ( 'background' , $ ( "#three" ) . attr ( "data-color" ) )
27
31
} ;
28
32
if ( $ ( document ) . scrollTop ( ) > $ ( "#four" ) . position ( ) . top ) {
29
-
30
33
$ ( 'body' ) . css ( 'background' , $ ( "#four" ) . attr ( "data-color" ) )
31
34
} ;
32
35
if ( $ ( document ) . scrollTop ( ) >= $ ( "#five" ) . position ( ) . top ) {
33
36
$ ( 'body' ) . css ( 'background' , $ ( "#five" ) . attr ( "data-color" ) )
34
37
} ;
35
38
} ) ;
36
- jackHarnerSig ( "light" )
37
39
</ script >
38
40
< style >
39
41
body {
You can’t perform that action at this time.
0 commit comments