Total Complexity | 9 |
Complexity/F | 1.13 |
Lines of Code | 48 |
Function Count | 8 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 1 |
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); |
||
|
|||
8 | }, |
||
9 | BlackBerry: function() { |
||
10 | //console.log(navigator.userAgent.match(/BlackBerry/i)); |
||
11 | return navigator.userAgent.match(/BlackBerry/i); |
||
12 | }, |
||
13 | iOS: function() { |
||
14 | //console.log(navigator.userAgent.match(/iPhone|iPad|iPod/i)); |
||
15 | return navigator.userAgent.match(/iPhone|iPad|iPod/i); |
||
16 | }, |
||
17 | Opera: function() { |
||
18 | //console.log(navigator.userAgent.match(/Opera Mini/i)); |
||
19 | return navigator.userAgent.match(/Opera Mini/i); |
||
20 | }, |
||
21 | Windows: function() { |
||
22 | //console.log(navigator.userAgent.match(/IEMobile/i)); |
||
23 | return navigator.userAgent.match(/IEMobile/i); |
||
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 |
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.