Total Complexity | 9 |
Complexity/F | 1.8 |
Lines of Code | 47 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | var $ = jQuery; |
||
2 | $( document ).ready(function() { |
||
3 | $('.scroll-contact').on('click',function () { |
||
4 | var contact = $('.b-container'); |
||
5 | $('html,body').animate({scrollTop: contact.offset().top}, 1500); |
||
6 | }); |
||
7 | |||
8 | var wi = $(window).width(); |
||
9 | |||
10 | if(wi <= 980){ |
||
11 | $('#header').removeClass('absolute'); |
||
12 | } |
||
13 | |||
14 | $(window).scroll(function() { |
||
15 | if($(window).scrollTop() > 0) { |
||
16 | $('#header').addClass('fixed'); |
||
17 | }else{ |
||
18 | $('#header').removeClass('fixed'); |
||
19 | } |
||
20 | }); |
||
21 | |||
22 | // browser window scroll (in pixels) after which the "back to top" link is shown |
||
23 | var offset = 300, |
||
24 | //browser window scroll (in pixels) after which the "back to top" link opacity is reduced |
||
25 | offset_opacity = 1200, |
||
26 | //duration of the top scrolling animation (in ms) |
||
27 | scroll_top_duration = 700, |
||
28 | //grab the "back to top" link |
||
29 | $back_to_top = $('.cd-top'); |
||
30 | |||
31 | //hide or show the "back to top" link |
||
32 | $(window).scroll(function(){ |
||
33 | ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out'); |
||
34 | if( $(this).scrollTop() > offset_opacity ) { |
||
35 | $back_to_top.addClass('cd-fade-out'); |
||
36 | } |
||
37 | }); |
||
38 | |||
39 | //smooth scroll to top |
||
40 | $back_to_top.on('click', function(event){ |
||
41 | event.preventDefault(); |
||
42 | $('body,html').animate({ |
||
43 | scrollTop: 0 , |
||
44 | }, scroll_top_duration |
||
45 | ); |
||
46 | }); |
||
47 | }); |
||
48 |