PageSourceSearch

https://htmlboutique.com/blog/wp-content/themes/htmlboutique-2016/js/functions.js?ver=1539606306

js htmlboutique.com collected 2026-09-25 21:32:17 UTC 3,816 bytes, 161 lines download raw bytes

1;(function($, window, document, undefined) {
2	var $win = $(window);
3	var $doc = $(document);
4	var winO = $win.scrollTop();
5	var winH = $win.height();
6	var winW = $win.width();
7	var $header, $animated,lastScrollTop, $btnTop;
8
9	function fullBackground($ele) {
10		$ele.each(function () {
11			var $this = $(this);
12			var $img = $this.find('img')
13			var bgSrc = $img.attr('src');
14			var styles = {
15				backgroundImage: 'url('+ bgSrc +')'
16			}
17
18			$this.css(styles);
19		});
20	}
21
22	$doc.ready(function() {
23		var $htmlBody = $('html, body');
24		var $body = $('body');
25		var $navTrigger = $('.nav-trigger');
26		var $sidebar = $('.sidebar');
27		var $loader = $('.loader');
28		var $tooltip = $('.tooltip');
29		var isntDesktop = $win.width() < 1025;
30		var $benefitsPage;
31		var faq_data = [];
32		lastScrollTop = 0;
33		$header = $('.header');
34		$btnTop = $('.btn-top');
35
36		if ( typeof DISQUSWIDGETS !== 'undefined' ) {
37			DISQUSWIDGETS.getCount({reset: true});
38		}
39
40		window.onpageshow = function(event) {
41			if (event.persisted) {
42				window.location.reload() 
43			}
44		};
45		
46		//Animated sections
47		$animated = $('.animated');
48
49		//Fadeout when changing page
50		$('a:not(.link-public)').on('click', function (event) {
51			var href = $(this).attr('href');
52			var key = event.which;
53
54			if (href != '#') {
55				if (key == 1) {
56					$('.wrapper').addClass('fadeout');
57					
58					setTimeout(function() {
59						window.location = href;
60					}, 400);
61				} else if ( key == 2) {
62					window.open(href,'_blank');
63				}
64				
65				event.preventDefault();
66			}
67		});
68
69		$('div.tip').each(function(){
70
71			if ( !$(this).find('p').length ) {
72				$(this).find('h5').css('margin-bottom', 0);
73			}
74
75		})
76
77		//Nav
78		$navTrigger.on('click', function (event) {
79			$body.toggleClass('sidebar-visible');
80		
81			event.preventDefault();
82		});
83
84		$sidebar.on('click', '.link-close', function (event) {
85			$body.removeClass('sidebar-visible')
86		
87			event.preventDefault();
88		});
89
90		$doc.on('click', function (event) {
91			var $target = $(event.target);
92			if ($target.closest('.sidebar').length && !$target.closest('.sidebar-inner').length) {
93				$body.removeClass('sidebar-visible');
94			}
95		});
96
97		//Scroll to main
98		$('.btn-scroll').on('click', function (event) {
99			$htmlBody.animate({
100				scrollTop: $('.main').offset().top - 67
101			}, 700);
102
103			event.preventDefault();
104		});
105
106		//Scroll to top
107		$btnTop.on('click', function (event) {
108			$htmlBody.animate({
109				scrollTop: 0
110			}, 700);
111
112			event.preventDefault();
113		});
114		
115		//Full backgrounds
116		fullBackground($('.intro-image, .section-callout .section-image, .section-team .section-image, .article .article-image, .section-benefits .section-image, .section-samples .section-image, .testimonial-image, .section-process .section-image, .section-about .section-image'));
117
118		//Show wrapper on page open
119		setTimeout(function() {
120			$('.wrapper').addClass('loaded');
121		}, 300);
122		
123		$win.on('load scroll', function() {
124
125			winO = $win.scrollTop();
126			var isHeaderCompact = winO > 1;
127			var isBtnTopVisible = winO > 400;
128
129			//Btn top visibility
130			if ($btnTop.length) {
131				$btnTop.parent().toggleClass('section-actions-visible', isBtnTopVisible);
132			}
133
134			//Header compact
135			$header.toggleClass('header-compact', isHeaderCompact);
136
137			//Intro image animations
138			if ($('.intro:not(.intro-secondary)').length) {
139				var opacity = 1 - (winO + winH - $('.intro').height())/1000;
140				
141				$('.intro').find('.intro-actions').css('opacity', opacity);
142			}
143
144			//Animated sections
145			$animated.each(function(){
146				var $section = $(this);
147				if ($section.hasClass('animated-in')){
148					return;
149				}
150
151				if (winO + winH*0.88 > $section.offset().top) {
152					$section.addClass('animated-in');
153				}
154			});
155
156		}).on('resize', function(){
157			winH = $win.height();
158			winW = $win.width();
159		});
160	});
161})(jQuery, window, document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.