PageSourceSearch

https://www.viola-group.com/wp-content/themes/viola/assets/home/js/home.js

js viola-group.com collected 2026-09-24 19:37:55 UTC 14,618 bytes, 575 lines download raw bytes

1/*
2 * jQuery throttle / debounce - v1.1 - 3/7/2010
3 * https://benalman.com/projects/jquery-throttle-debounce-plugin/
4 * 
5 * Copyright (c) 2010 "Cowboy" Ben Alman
6 * Dual licensed under the MIT and GPL licenses.
7 * https://benalman.com/about/license/
8 */
9(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
10
11$(document).ready(function(){
12	$(".container-fluid.footer-top").addClass("padded");
13	$(".container-fluid.footer-bottom").addClass("padded");
14	var vw = $(window).width(),
15		menu = $('.sticky-menu'),
16		menuBtn = $('.sticky-menu .btn'),
17		hero = $('.hero'),
18		lastScrollPos = 0,
19		wScroll = $(window).scrollTop(),
20		i = 0,
21		direction;
22
23
24	$(window).bind('mousewheel DOMMouseScroll', function(event) {
25	    if (event.originalEvent.wheelDelta >= 0) {
26	    	direction = 'up';
27	    }
28	    else {
29	        direction = 'down';
30	    }
31	    // console.log(direction);
32	});
33
34	// Menu hovers
35	$('.menu-item')
36	.on('mouseover', function(){
37
38		$('.menu-item').css({
39			'opacity' : '0.5'
40		});
41
42		$(this).css({
43			'opacity' : '1'
44		});
45
46	})
47	.on('mouseleave', function(){
48		$('.menu-item').css({
49			'opacity' : '1'
50		});
51	});
52
53	// Parrallax
54	$(window).scroll(function(){
55
56		var wScroll = $(this).scrollTop();
57
58		// Hero Image
59		$('.hero').css({
60			'background-position' : 'center ' + wScroll / 2 + 'px'
61		});
62
63		if (wScroll > $('.footer-top').position().top - $(window).height()) {
64			$('.pers-foot').addClass('down');
65		} else {
66			$('.pers-foot').removeClass('down');
67		}
68
69		if ($('body').hasClass('home-page') && vw > 768) {
70			// Viola Plus
71			var blockFromTop = $('.blocks-wrap').length > 0 ? $('.blocks-wrap').position().top - ($(window).height()/2) : 0;
72			if(wScroll > blockFromTop){
73				// console.log(wScroll, blockFromTop);
74				// console.log(wScroll - $('.viola-plus .blocks-wrap').offset().top);
75
76				$('.blocks-wrap .img-block').css({
77					'transform' : 'translate(0, -' + (wScroll - blockFromTop) / 12 + '%'
78				});
79
80				$('.blocks-wrap .blue-block').css({
81					'transform' : 'translate(0, -' + (wScroll - blockFromTop) / 32 + '%'
82				});
83
84				$('.viola-plus .more-h').css({
85					'transform' : 'translate(0, ' + (wScroll - blockFromTop) / 24 + 'px'
86				});
87
88			}
89		}
90
91		
92
93	});
94
95
96
97	// Cards Section
98	$(".select-row .select-inner").on('mouseover', function(){
99			var index = $(this).index();
100				
101			// console.log(index);
102			$('.select-row .select-inner').css('opacity', '0.3');
103			$(this).css('opacity', '1');
104			$(".cards-intro").removeClass("active");
105			$(".card-outer").removeClass("active");
106			setTimeout(function(){
107				$(".card-outer").eq(index).addClass("active");	
108			}, 300);
109			
110
111		})
112		$("#closer").on('mouseover', function(){
113			$('.select-row .select-inner').css('opacity', '1');
114			$(".card-outer").removeClass("active");
115			setTimeout(function(){
116				$(".cards-intro").addClass("active");	
117			}, 300);
118		});
119
120		
121		$("#cards-section").on('mouseleave', function(){
122			$('.select-row .select-inner').css('opacity', '1');
123			$(".card-outer").removeClass("active");
124			setTimeout(function(){
125				$(".cards-intro").addClass("active");
126			}, 300);
127		});
128
129	// Hero Transition
130	$('body.overflow-hidden').on('mousewheel DOMMouseScroll', function(){
131
132		if(direction == 'down') {
133			$('body').removeClass('overflow-hidden');
134			$(menu).addClass('white');
135			$(menuBtn).removeClass('white-outline-btn').addClass('blue-btn');
136
137			hero.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',
138				function(e) {
139					$('body').css('overflow', 'visible');
140					$(menu).css('background-color', '#FFF');
141					$(hero).css({
142								  // 'box-shadow': '0 20px 80px -10px rgba(0, 0, 0, 0.3)',
143								  'z-index': '1'
144								});
145					$(document).trigger("heroFinish");
146				});
147		}
148
149
150	});
151
152	$(document).on("heroFinish", function(){
153
154		$(document).on("scroll", function(){
155
156			if ($(this).scrollTop() == 0 && direction == 'up') {
157				
158				// console.log('Here');
159
160				$('body').addClass('overflow-hidden').css('overflow', 'hidden');
161				$(menu).removeClass('white');
162				$(menuBtn).addClass('white-outline-btn').removeClass('blue-btn');
163				$(menu).css('background-color', 'transparent');
164				$(hero).css({
165						  // 'box-shadow': '0 20px 80px -10px rgba(0, 0, 0, 0.3)',
166						  'z-index': '99'
167						});
168
169				
170				hero.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',
171					function(e) {
172						$(menu).css('background-color', 'transparent');
173						$('body').css('overflow', 'hidden');
174						$(hero).css({
175									  // 'box-shadow': '0 20px 80px -10px rgba(0, 0, 0, 0.3)',
176									  'z-index': '99'
177									});
178						// $(document).trigger("heroFinish");
179					});
180
181			}
182
183		});
184
185	});
186
187	// Homepage Gallery
188	if ($('body').hasClass('home-page')) {
189			
190			var slider = $( '#imgslider .center' );
191
192			$(slider).slick({
193		        dots: false,
194		        infinite: true,
195		        centerMode: false,
196				center: true,
197		        slidesToShow: 1.67,
198		        slidesToScroll: 1.5,
199		        autoplay: true,
200		        autoplaySpeed: 20000,
201				responsive: [
202					{
203						breakpoint: 1024,
204						settings: {
205						slidesToShow: 1,
206						slidesToScroll: 1
207					}
208				},
209					{
210						breakpoint: 600,
211						settings: {
212						slidesToShow: 1,
213						slidesToScroll: 1
214					}
215				},
216					{
217						breakpoint: 480,
218						settings: {
219						slidesToShow: 1,
220						slidesToScroll: 1
221					}
222				}
223		    // You can unslick at a given breakpoint now by adding:
224		    // settings: "unslick"
225		    // instead of a settings object
226			]
227
228			});
229			var slider2 = $( '#imgslider2 .center2' );
230			$(slider2).slick({
231		        dots: false,
232		        infinite: true,
233				centerMode: true,
234		        slidesToShow: 3,
235		        slidesToScroll: 1,
236		        autoplay: true,
237		        autoplaySpeed: 3000,
238				responsive: [
239					{
240						breakpoint: 1024,
241						settings: {
242							slidesToShow: 1,
243							slidesToScroll: 1,
244							infinite: true,
245        					dots: true
246						}
247					}
248				]
249
250			});
251
252			$(".center .slick-slide").click(function(e){
253				e.preventDefault();
254
255				slideIndex = $(this).attr('data-slick-index');
256				// cloned = $('.slick-cloned').length,
257				// newSlide = slideIndex - cloned;
258
259				// console.log(slideIndex);
260
261				$( slider ).slick( 'slickGoTo', slideIndex );
262			});
263
264		     $('#imgslider .slick-prev').detach().appendTo('.gallery-controls');
265		     $('#imgslider .slick-next').detach().appendTo('.gallery-controls');
266		     $('#imgslider2 .slick-prev').detach().appendTo('.gallery-controls2');
267		     $('#imgslider2 .slick-next').detach().appendTo('.gallery-controls2');
268		     // $('.gallery-controls .slick-prev').html("<h1>asd</h1>");
269
270
271		     $('.mostviewed .notes-label').each(function(){
272		     	$(this).html('<h5 class="viewed-label">Featured</h5>')
273		     });
274
275		     $('.latest .notes-label').each(function(){
276		     	$(this).html('<h5 class="viewed-label">Most Recent</h5>')
277		     });
278
279		     $('.notes-inner').each(function(){
280		     	if($(this).hasClass('video')) {
281		     		$(this).find('.notes-icon').html('<img src="assets/img/icons/video-icon.png">')
282		     	}
283		     });
284	}
285
286	// Menu Transition
287	if ($('body').hasClass('home-page') == false && vw > 786) {
288		$(window).scroll(function(){
289
290			var menu = $('.sticky-menu')
291				menuBtn = $('.sticky-menu .btn')
292				wScroll = $(window).scrollTop();
293
294			if (wScroll >= 170) {
295				menu.addClass('white');
296				menuBtn.removeClass('white-outline-btn').addClass('blue-btn');
297			} else {
298				menu.removeClass('white');
299				menuBtn.removeClass('blue-btn').addClass('white-outline-btn');
300			}
301
302		});
303	}
304
305
306
307
308
309
310	// Portfolio Transition
311	var pfBtn = $('.portfolio-controls .control'),
312		pfItem = $('.portfolio-item');
313
314	
315
316	$(pfBtn).on('click', function(e){
317
318		var that = this,
319			pfLeft = $('.portfolio-item.left'),
320			pfCurrent = $('.portfolio-item.current'),
321			pfRight = $('.portfolio-item.right')
322			noTransition = 'transition', 'none',
323			yesTransition = 'transition', 'all 100ms 0.3s ease-in;';
324
325		e.preventDefault();
326
327		if($(".yesTransition").length == 0) {
328
329
330			if($(this).hasClass('right-control')) {
331				// console.log('left');
332				moveLine("right");
333				$(pfLeft)
334					.removeClass('left yesTransition')
335					.addClass('right')
336
337				$(pfCurrent)
338					.addClass('out outLeft left yesTransition');
339
340				$(pfRight)
341					.removeClass('right')
342					.addClass('current in inLeft yesTransition');
343
344				setTimeout(function(){
345					$('.portfolio-item.current.in.inLeft').removeClass('in inLeft yesTransition');
346					$('.portfolio-item.current.out.outLeft').removeClass('current out outLeft');
347					$('.portfolio-item.left').removeClass('yesTransition');
348					updateSlides("right");
349				}, 800);
350
351			}
352
353			if($(this).hasClass('left-control')) {
354				// console.log('right');
355				// $(pfCurrent).removeClass('left').addClass('current');
356				moveLine("left");
357
358				$(pfLeft).removeClass('left')
359					.addClass('current in inRight yesTransition')
360					.css(yesTransition);
361
362				$(pfCurrent)
363					.addClass('out outRight right yesTransition')
364					.css(yesTransition);
365
366				$(pfRight)
367					.removeClass('right yesTransition')
368					.addClass('left');
369
370
371				setTimeout(function(){
372					$('.portfolio-item.current.in.inRight').removeClass('in inRight yesTransition');
373					$('.portfolio-item.current.right').removeClass('out outRight current yesTransition');
374					// $('.portfolio-item.current.out.outLeft').removeClass('current out outLeft');
375					// $('.portfolio-item.left').removeClass('yesTransition');
376					updateSlides("left");
377					
378				}, 800);
379
380			}
381
382		}
383
384	});
385
386
387
388
389
390
391
392
393	$('.magic-nav ul li a').on('click', function(event) {
394
395		event.preventDefault();
396		
397		if ( animateProtect ) {
398			return;
399		}
400
401		var id = $(this).html();
402		var newScreen = $('.inner').attr('id') == $(id);
403
404
405		
406
407
408
409		$('.magic-nav ul li a').removeClass('active');
410		$(this).addClass('active');
411
412		if (!$('.inner:animated').length) {
413
414		    if ($(this).html() != $('.inner.active').attr("id")) {
415
416		        $('.inner.active').animate({
417		        	opacity: 0
418		        }, 500, function(){
419		        	$('.inner#' + id + '').animate({
420			        	opacity: 1
421			        }, 500);
422			        $('.inner.active').removeClass('active');
423			        $('.inner#' + id + '').addClass('active');
424		        });
425
426		        var newIndex = $(this).parent().index();
427				currentSlide = newIndex-1;
428				loadSlideData($(".portfolio-item.right"), sliderData[newIndex]);
429		        $(".portfolio-controls .control.right-control").click();
430		        
431		    }
432
433		    else {
434		    	return;
435		    }
436
437		}
438	});
439
440	// Magic Line
441	var $el, leftPos, newWidth,
442	        $mainNav = $(".magic-nav ul"),
443	        $navLink = $('.magic-nav ul li a');
444	        $activeLink = $('.magic-nav ul li a.active');
445
446	    
447	    var $magicLine = $("#magic-line");
448
449	if ($('body').hasClass('about-page') && vw > 768) {
450	    
451	    $magicLine
452	        .width($($activeLink).width())
453	        .css("right", $($activeLink).position().top)
454	        .data("origRight", $magicLine.position().top)
455	        
456	    // $($navLink).click(function() {
457	    //     $el = $(this);
458	    //     leftPos = $el.position().top;
459	    //     $magicLine.stop().animate({
460	    //         right: leftPos,
461	    //     }, 300);
462	    // });
463
464	} else {
465
466		// console.log("$($activeLink).innerWidth() ", $($activeLink).innerWidth());
467		$magicLine
468	        .width($($activeLink).innerWidth())
469	        .css("left", $activeLink.position().left)
470	        .data("origleft", $activeLink.position().left);
471	        
472	    // $($navLink).click(function() {
473	    //     $el = $(this);
474	    //     leftPos = $el.position().left;
475	    //     $magicLine.stop().animate({
476	    //         left: leftPos,
477	    //     }, 300);
478	    // });
479
480	}
481
482	// setInterval(function(){
483		
484	// 	if (i >= $('.magic-nav ul li a').length) {
485	// 		$('.magic-nav ul li a').eq(0).trigger('click');
486	// 		i = 0;
487	// 	} else {
488	// 		$('.magic-nav ul li a.active').closest('li').next('li').children('a').trigger('click');
489	// 	}
490		
491	// 	i++;
492
493	// }, 5000);
494	
495	
496
497	// Mobile JS
498	if (vw < 768) {
499		menuBtn.removeClass('white-outline-btn').addClass('blue-btn');
500			$('body').removeClass('overflow-hidden').css('overflow-y', 'visible');
501			$('.viola-plus .blocks-wrap .img-block .more-h').appendTo('.viola-plus .blocks-wrap');
502		
503
504		$('.select-row .select-inner').on('click', function(){
505
506			setTimeout(function() {
507				var h = $('.card-outer.active').innerHeight();
508
509				// console.log(h);
510
511				$('.cards-section .cards-inner').height(h);
512			}, 500);
513
514		});
515
516		$(window).on('scroll', function(){
517			wScroll = $(window).scrollTop();
518			if (wScroll >= 170) {
519				menu.addClass('white');
520				// menuBtn.removeClass('white-outline-btn').addClass('blue-btn');
521			} else {
522				menu.removeClass('white');
523				// menuBtn.removeClass('blue-btn').addClass('white-outline-btn');
524			}
525		});
526
527	}
528
529
530	//Homepage left label
531	if ( $("body").hasClass("home-page") ) {
532
533	    jQuery(document).ready(function () {
534		    jQuery(document).on("scroll", onScroll);
535		    
536		    //smoothscroll
537		    jQuery('#pasparto a[href^="#"]').on('click', function (e) {
538		        e.preventDefault();
539		        jQuery(document).off("scroll");
540		        
541		        jQuery('#pasparto a').each(function () {
542		            jQuery(this).removeClass('active');
543		        })
544		        jQuery(this).addClass('active');
545		      
546		        var target = this.hash,
547		            menu = target;
548		        $target = jQuery(target);
549		        jQuery('html, body').stop().animate({
550		            'scrollTop': $target.offset().top+2
551		        }, 500, 'swing', function () {
552		            window.location.hash = target;
553		            jQuery(document).on("scroll", onScroll);
554		        });
555		    });
556		});
557
558		function onScroll(event){
559		    var scrollPos = jQuery(document).scrollTop();
560		    jQuery('#pasparto a').each(function () {
561		        var currLink = jQuery(this);
562		        var refElement = jQuery(currLink.attr("href"));
563		        if (refElement?.position()?.top-500 <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
564		            jQuery('#pasparto li').removeClass("switchttl");
565		            currLink.parent().addClass("switchttl");
566		        }
567		        else{
568		            currLink.removeClass("switchttl");
569		        }
570		    });
571		}
572
573	}
574
575});

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.