Passed
Push — master ( 445199...b3e6af )
by Davide
03:36
created

resources/assets/js/laravel-jumbotron-images.js   A

Complexity

Total Complexity 9
Complexity/F 1.13

Size

Lines of Code 48
Function Count 8

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
cc 0
eloc 23
nc 5
dl 0
loc 48
rs 10
c 3
b 1
f 1
wmc 9
mnd 1
bc 10
fnc 8
bpm 1.25
cpm 1.125
noi 5
1
$(document).ready(function () {
2
3
	// Check if is mobile
4
		var isMobile = {
5
	        Android: function() {
6
	        	//console.log(navigator.userAgent.match(/Android/i));
7
	            return navigator.userAgent.match(/Android/i);
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
8
	        },
9
	        BlackBerry: function() {
10
	        	//console.log(navigator.userAgent.match(/BlackBerry/i));
11
	            return navigator.userAgent.match(/BlackBerry/i);
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
12
	        },
13
	        iOS: function() {
14
	        	//console.log(navigator.userAgent.match(/iPhone|iPad|iPod/i));
15
	            return navigator.userAgent.match(/iPhone|iPad|iPod/i);
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
16
	        },
17
	        Opera: function() {
18
	        	//console.log(navigator.userAgent.match(/Opera Mini/i));
19
	            return navigator.userAgent.match(/Opera Mini/i);
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
20
	        },
21
	        Windows: function() {
22
	        	//console.log(navigator.userAgent.match(/IEMobile/i));
23
	            return navigator.userAgent.match(/IEMobile/i);
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
24
	        },
25
	        any: function() {
26
	        	//console.log(isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
27
	            return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
28
	        }
29
	    };
30
31
	// Parallax with stellar - http://markdalgleish.com/projects/stellar.js
32
		if( !isMobile.any() ){
33
	        $(function(){
34
	                //console.log("is not mobile");
35
	                $.stellar({
36
	                    horizontalScrolling: false,
37
	                    // Refreshes parallax content on window load and resize
38
	                    responsive: true,
39
	                    verticalOffset: 60	//original was 40 (with 40 i have a gray line above the big image while scrolling with scalable bar)
40
	                });
41
	    	});
42
43
		}
44
		else{
45
			$(".jumbotronImage .hero.parallax").css("background-attachment", "scroll");
46
	        $(".jumbotronImage .hero.parallax").css("background-size", "190% 100%");
47
		}
48
});
49