1
1
export default {
2
- name : 'ripple' ,
3
- bind ( el , binding ) {
2
+ bind : function ( el , binding ) {
4
3
5
4
// Default values.
6
5
const props = {
@@ -10,17 +9,17 @@ export default {
10
9
11
10
setProps ( Object . keys ( binding . modifiers ) , props ) ;
12
11
13
- el . addEventListener ( props . event , ( event ) => {
12
+ el . addEventListener ( props . event , function ( event ) {
14
13
rippler ( event , el , binding . value ) ;
15
14
} ) ;
16
15
17
- let bg = binding . value || 'rgba(0, 0, 0, 0.35)' ;
16
+ var bg = binding . value || 'rgba(0, 0, 0, 0.35)' ;
18
17
19
18
function rippler ( event , el ) {
20
- let target = el ;
19
+ var target = el ;
21
20
22
21
// Get necessary variables
23
- let rect = target . getBoundingClientRect ( ) ,
22
+ var rect = target . getBoundingClientRect ( ) ,
24
23
left = rect . left ,
25
24
top = rect . top ,
26
25
width = target . offsetWidth ,
@@ -33,21 +32,21 @@ export default {
33
32
radius = Math . sqrt ( ( maxX * maxX ) + ( maxY * maxY ) ) ;
34
33
35
34
// Create the ripple and its container
36
- let ripple = document . createElement ( "div" ) ,
35
+ var ripple = document . createElement ( "div" ) ,
37
36
rippleContainer = document . createElement ( "div" ) ;
38
37
39
38
//Styles for ripple
40
39
ripple . style . marginTop = '0px' ;
41
40
ripple . style . marginLeft = '0px' ;
42
41
ripple . style . width = '1px' ;
43
42
ripple . style . height = '1px' ;
44
- ripple . style . transition = ` all ${ props . transition } ms cubic-bezier(0.4, 0, 0.2, 1)` ;
43
+ ripple . style . transition = ' all ' + props . transition + ' ms cubic-bezier(0.4, 0, 0.2, 1)' ;
45
44
ripple . style . borderRadius = '50%' ;
46
45
ripple . style . pointerEvents = 'none' ;
47
46
ripple . style . position = 'relative' ;
48
47
ripple . style . zIndex = '9999' ;
49
48
ripple . style . backgroundColor = bg ;
50
-
49
+
51
50
//Styles for rippleContainer
52
51
rippleContainer . style . position = 'absolute' ;
53
52
rippleContainer . style . left = '0' ;
@@ -56,7 +55,7 @@ export default {
56
55
rippleContainer . style . width = '0' ;
57
56
rippleContainer . style . pointerEvents = 'none' ;
58
57
rippleContainer . style . overflow = 'hidden' ;
59
-
58
+
60
59
rippleContainer . appendChild ( ripple ) ;
61
60
document . body . appendChild ( rippleContainer ) ;
62
61
@@ -93,7 +92,7 @@ export default {
93
92
}
94
93
95
94
function setProps ( modifiers , props ) {
96
- modifiers . forEach ( ( item ) => {
95
+ modifiers . forEach ( function ( item ) {
97
96
if ( isNaN ( Number ( item ) ) )
98
97
props . event = item ;
99
98
else
0 commit comments