PageSourceSearch

https://douglas-cs.co.uk/wp-content/themes/fionca/assets/js/script.js?ver=1790599224

js douglas-cs.co.uk collected 2026-09-28 12:41:31 UTC 17,108 bytes, 728 lines download raw bytes

1(function($) {
2	"use strict";
3	//Hide Loading Box (Preloader)
4	function handlePreloader() {
5		if($('.loader-wrap').length){
6			$('.loader-wrap').delay(1000).fadeOut(500);
7		}
8		TweenMax.to($(".loader-wrap .overlay"), 1.2, {
9            force3D: true,
10            left: "100%",
11            ease: Expo.easeInOut,
12        });
13	}
14	if ($(".preloader-close").length) {
15        $(".preloader-close").on("click", function(){
16            $('.loader-wrap').delay(200).fadeOut(500);
17        })
18    }
19	//Update Header Style and Scroll to Top
20	function headerStyle() {
21		if($('.main-header').length){
22			var windowpos = $(window).scrollTop();
23			var siteHeader = $('.main-header');
24			var scrollLink = $('.scroll-top');
25			if (windowpos >= 110) {
26				siteHeader.addClass('fixed-header');
27				scrollLink.addClass('open');
28			} else {
29				siteHeader.removeClass('fixed-header');
30				scrollLink.removeClass('open');
31			}
32		}
33	}
34	headerStyle();
35	//Submenu Dropdown Toggle
36	if($('.main-header li.dropdown ul').length){
37		$('.main-header .navigation li.dropdown').append('<div class="dropdown-btn"><span class="fas fa-angle-down"></span></div>');
38	}
39	//Mobile Nav Hide Show
40	if($('.mobile-menu').length){
41		
42		$('.mobile-menu .menu-box').mCustomScrollbar();
43		
44		var mobileMenuContent = $('.main-header .menu-area .main-menu').html();
45		$('.mobile-menu .menu-box .menu-outer').append(mobileMenuContent);
46		$('.sticky-header .main-menu').append(mobileMenuContent);
47		
48		//Dropdown Button
49		$('.mobile-menu li.dropdown .dropdown-btn').on('click', function() {
50			$(this).toggleClass('open');
51			$(this).prev('ul').slideToggle(500);
52		});
53		//Dropdown Button
54		$('.mobile-menu li.dropdown .dropdown-btn').on('click', function() {
55			$(this).prev('.megamenu').slideToggle(900);
56		});
57		//Menu Toggle Btn
58		$('.mobile-nav-toggler').on('click', function() {
59			$('body').addClass('mobile-menu-visible');
60		});
61
62		//Menu Toggle Btn
63		$('.mobile-menu .menu-backdrop,.mobile-menu .close-btn').on('click', function() {
64			$('body').removeClass('mobile-menu-visible');
65		});
66	}
67	jQuery( ".bg_image" ).each(function() {
68        var attr = $(this).attr('data-image-src');
69        if (typeof attr !== typeof undefined && attr !== false) {
70            $(this).css('background-image', 'url('+attr+')');
71        }
72    });
73
74	//Side Nav Hide Show
75	if($('.side-menu').length){
76		
77		$('.side-menu .menu-box').mCustomScrollbar();
78		
79		var mobileMenuContent = $('.main-header .menu-area .main-menu').html();
80		$('.side-menu .menu-box .menu-outer').append(mobileMenuContent);
81		
82		//Dropdown Button
83		$('.side-menu li.dropdown .dropdown-btn').on('click', function() {
84			$(this).toggleClass('open');
85			$(this).prev('ul').slideToggle(500);
86		});
87		//Dropdown Button
88		$('.side-menu li.dropdown .dropdown-btn').on('click', function() {
89			$(this).prev('.megamenu').slideToggle(900);
90		});
91	}
92
93
94	// Scroll to a Specific Div
95	if($('.scroll-to-target').length){
96		$(".scroll-to-target").on('click', function() {
97			var target = $(this).attr('data-target');
98		   // animate
99		   $('html, body').animate({
100			   scrollTop: $(target).offset().top
101			 }, 1000);
102	
103		});
104	}
105
106	// Elements Animation
107	if($('.wow').length){
108		var wow = new WOW({
109		mobile:       false
110		});
111		wow.init();
112	}
113
114
115	//Contact Form Validation
116	if($('#contact-form').length){
117		$('#contact-form').validate({
118			rules: {
119				username: {
120					required: true
121				},
122				email: {
123					required: true,
124					email: true
125				},
126				phone: {
127					required: true
128				},
129				subject: {
130					required: true
131				},
132				message: {
133					required: true
134				}
135			}
136		});
137	}
138
139	//Fact Counter + Text Count
140	if($('.count-box').length){
141		$('.count-box').appear(function(){
142	
143			var $t = $(this),
144				n = $t.find(".count-text").attr("data-stop"),
145				r = parseInt($t.find(".count-text").attr("data-speed"), 10);
146				
147			if (!$t.hasClass("counted")) {
148				$t.addClass("counted");
149				$({
150					countNum: $t.find(".count-text").text()
151				}).animate({
152					countNum: n
153				}, {
154					duration: r,
155					easing: "linear",
156					step: function() {
157						$t.find(".count-text").text(Math.floor(this.countNum));
158					},
159					complete: function() {
160						$t.find(".count-text").text(this.countNum);
161					}
162				});
163			}
164			
165		},{accY: 0});
166	}
167
168
169	//LightBox / Fancybox
170	if($('.lightbox-image').length) {
171		$('.lightbox-image').fancybox({
172			openEffect  : 'fade',
173			closeEffect : 'fade',
174			helpers : {
175				media : {}
176			}
177		});
178	}
179
180
181	//Tabs Box
182	if($('.tabs-box').length){
183		$('.tabs-box .tab-buttons .tab-btn').on('click', function(e) {
184			e.preventDefault();
185			var target = $($(this).attr('data-tab'));
186			
187			if ($(target).is(':visible')){
188				return false;
189			}else{
190				target.parents('.tabs-box').find('.tab-buttons').find('.tab-btn').removeClass('active-btn');
191				$(this).addClass('active-btn');
192				target.parents('.tabs-box').find('.tabs-content').find('.tab').fadeOut(0);
193				target.parents('.tabs-box').find('.tabs-content').find('.tab').removeClass('active-tab');
194				$(target).fadeIn(300);
195				$(target).addClass('active-tab');
196			}
197		});
198	}
199
200
201
202	//Accordion Box
203	if($('.accordion-box').length){
204		$(".accordion-box").on('click', '.acc-btn', function() {
205			
206			var outerBox = $(this).parents('.accordion-box');
207			var target = $(this).parents('.accordion');
208			
209			if($(this).hasClass('active')!==true){
210				$(outerBox).find('.accordion .acc-btn').removeClass('active');
211			}
212			
213			if ($(this).next('.acc-content').is(':visible')){
214				return false;
215			}else{
216				$(this).addClass('active');
217				$(outerBox).children('.accordion').removeClass('active-block');
218				$(outerBox).find('.accordion').children('.acc-content').slideUp(300);
219				target.addClass('active-block');
220				$(this).next('.acc-content').slideDown(300);	
221			}
222		});	
223	}
224
225	$(window).load(function() {
226	// banner-carousel
227		if ($('.banner-carousel').length) {
228			$('.banner-carousel').owlCarousel({
229				loop:true,
230				margin:0,
231				nav:true,
232				animateOut: 'fadeOut',
233				animateIn: 'fadeIn',
234				active: true,
235				smartSpeed: 1000,
236				autoplay: 6000,
237				navText: [ '<span class="fas fa-arrow-left"></span>', '<span class="fas fa-arrow-right"></span>' ],
238				responsive:{
239					0:{
240						items:1
241					},
242					600:{
243						items:1
244					},
245					800:{
246						items:1
247					},
248					1024:{
249						items:1
250					}
251				}
252			});
253		}
254	});
255
256     // sidebar-carousel
257	if ($('.sidebar-carousel').length) {
258        $('.sidebar-carousel').owlCarousel({
259            loop:true,
260			margin:30,
261			nav:true,
262			smartSpeed: 500,
263			autoplay: 1000,
264			navText: [ '<span class="fas fa-arrow-left"></span>', '<span class="fas fa-arrow-right"></span>' ],
265			responsive:{
266                0:{
267                    items:1
268                },
269                600:{
270                    items:1
271                },
272                800:{
273                    items:1
274                },
275                1024:{
276                    items:1
277                }
278            }
279        });
280    }
281
282
283     // news-carousel
284	if ($('.news-carousel').length) {
285        $('.news-carousel').owlCarousel({
286            loop:true,
287			margin:30,
288			nav:true,
289			smartSpeed: 500,
290			autoplay: 1000,
291			navText: [ '<span class="fas fa-angle-left"></span>', '<span class="fas fa-angle-right"></span>' ],
292			responsive:{
293                0:{
294                    items:1
295                },
296                600:{
297                    items:1
298                },
299                800:{
300                    items:1
301                },
302                1024:{
303                    items:1
304                }
305            }
306        });
307    }
308
309
310    //three-item-carousel
311	if ($('.three-item-carousel').length) {
312		$('.three-item-carousel').owlCarousel({
313			loop:true,
314			margin:30,
315			nav:true,
316			smartSpeed: 1000,
317			autoplay: 500,
318			navText: [ '<span class="fas fa-arrow-left"></span>', '<span class="fas fa-arrow-right"></span>' ],
319			responsive:{
320				0:{
321					items:1
322				},
323				480:{
324					items:1
325				},
326				600:{
327					items:2
328				},
329				800:{
330					items:2
331				},
332				1024:{
333					items:3
334				}
335			}
336		});    		
337	}
338
339	// Four Item Carousel
340	if ($('.four-item-carousel').length) {
341		$('.four-item-carousel').owlCarousel({
342			loop:true,
343			margin:30,
344			nav:true,
345			autoHeight: true,
346			smartSpeed: 500,
347			autoplay: 5000,
348			navText: [ '<span class="fas fa-angle-left"></span>', '<span class="fas fa-angle-right"></span>' ],
349			responsive:{
350				0:{
351					items:1
352				},
353				600:{
354					items:2
355				},
356				800:{
357					items:3
358				},
359				1024:{
360					items:3
361				},
362				1200:{
363					items:4
364				}
365			}
366		});    		
367	}
368
369	//two-column-carousel
370	if ($('.two-column-carousel').length) {
371		$('.two-column-carousel').owlCarousel({
372			loop:true,
373			margin:30,
374			nav:true,
375			smartSpeed: 3000,
376			autoplay: 4000,
377			navText: [ '<span class="fa fa-caret-left"></span>', '<span class="fa fa-caret-right"></span>' ],
378			responsive:{
379				0:{
380					items:1
381				},
382				480:{
383					items:1
384				},
385				600:{
386					items:1
387				},
388				800:{
389					items:2
390				},
391				1024:{
392					items:2
393				}
394			}
395		});    		
396	}
397	//Client Testimonial Carousel
398	if ($('.client-testimonial-carousel').length && $('.client-thumbs-carousel').length) {
399
400		var $sync3 = $(".client-testimonial-carousel"),
401			$sync4 = $(".client-thumbs-carousel"),
402			flag = false,
403			duration = 500;
404
405			$sync3
406				.owlCarousel({
407					loop:true,
408					items: 1,
409					margin: 0,
410					nav: true,
411					navText: [ '<span class="fas fa-arrow-left"></span>', '<span class="fas fa-arrow-right"></span>' ],
412					dots: false,
413					autoplay: true,
414					autoplayTimeout: 5000
415				})
416				.on('changed.owl.carousel', function (e) {
417					if (!flag) {
418						flag = false;
419						$sync4.trigger('to.owl.carousel', [e.item.index, duration, true]);
420						flag = false;
421					}
422				});
423
424			$sync4
425				.owlCarousel({
426					loop:true,
427					margin:10,
428					items: 1,
429					nav: false,
430					navText: [ '<span class="icon fa fa-long-arrow-left"></span>', '<span class="icon fa fa-long-arrow-right"></span>' ],
431					dots: true,
432					center: false,
433					autoplay: true,
434					autoplayTimeout: 5000,
435					responsive: {
436						0:{
437				            items:1,
438				            autoWidth: false
439				        },
440				        400:{
441				            items:1,
442				            autoWidth: false
443				        },
444				        600:{
445				            items:1,
446				            autoWidth: false
447				        },
448				        1000:{
449				            items:1,
450				            autoWidth: false
451				        },
452						1200:{
453				            items:1,
454				            autoWidth: false
455				        }
456				    },
457				})
458				
459		.on('click', '.owl-item', function () {
460			$sync3.trigger('to.owl.carousel', [$(this).index(), duration, true]);
461		})
462		.on('changed.owl.carousel', function (e) {
463			if (!flag) {
464				flag = true;		
465				$sync3.trigger('to.owl.carousel', [e.item.index, duration, true]);
466				flag = false;
467			}
468		});
469	}
470	// project-carousel-2
471	if ($('.project-carousel-2').length) {
472        $('.project-carousel-2').owlCarousel({
473            loop:true,
474			margin:0,
475			nav:true,
476			animateOut: 'fadeOut',
477    		animateIn: 'fadeIn',
478    		active: true,
479			smartSpeed: 1000,
480			autoplay: 6000,
481            navText: [ '<span class="fas fa-arrow-left"></span>', '<span class="fas fa-arrow-right"></span>' ],
482            responsive:{
483                0:{
484                    items:1
485                },
486                600:{
487                    items:1
488                },
489                800:{
490                    items:1
491                },
492                1024:{
493                    items:1
494                }
495            }
496        });
497    }
498
499	// clients-carousel
500	if ($('.clients-carousel').length) {
501		$('.clients-carousel').owlCarousel({
502			loop:true,
503			margin:30,
504			nav:false,
505			smartSpeed: 3000,
506			autoplay: true,
507			navText: [ '<span class="flaticon-left"></span>', '<span class="flaticon-right"></span>' ],
508			responsive:{
509				0:{
510					items:1
511				},
512				480:{
513					items:2
514				},
515				600:{
516					items:3
517				},
518				800:{
519					items:4
520				},			
521				1200:{
522					items:5
523				}
524
525			}
526		});    		
527	}
528
529	//Add One Page nav
530	if($('.scroll-nav').length) {
531		$('.scroll-nav').onePageNav();
532	}
533
534	//Progress Bar
535	if ($('.count-bar').length) {
536		$('.count-bar').appear(function(){
537			var el = $(this);
538			var percent = el.data('percent');
539			$(el).css('width',percent).addClass('counted');
540		},{accY: -50});
541
542	}
543
544	//Search Popup
545	if($('#search-popup').length){
546		
547		//Show Popup
548		$('.search-toggler').on('click', function() {
549			$('#search-popup').addClass('popup-visible');
550		});
551		$(document).keydown(function(e){
552	        if(e.keyCode === 27) {
553	            $('#search-popup').removeClass('popup-visible');
554	        }
555	    });
556		//Hide Popup
557		$('.close-search,.search-popup .overlay-layer').on('click', function() {
558			$('#search-popup').removeClass('popup-visible');
559		});
560	}
561
562	// page direction
563	function directionswitch() {
564	  	if ($('.page_direction').length) {
565
566	    	$('.direction_switch button').on('click', function() {
567			   $('body').toggleClass(function(){
568			      return $(this).is('.rtl, .ltr') ? 'rtl ltr' : 'rtl';
569			  })
570			});
571	  	};
572	}
573
574	// pieChart RoundCircle
575	function expertizeRoundCircle () {
576		var rounderContainer = $('.piechart');
577		if (rounderContainer.length) {
578			rounderContainer.each(function () {
579				var Self = $(this);
580				var value = Self.data('value');
581				var size = Self.parent().width();
582				var color = Self.data('fg-color');
583
584				Self.find('span').each(function () {
585					var expertCount = $(this);
586					expertCount.appear(function () {
587						expertCount.countTo({
588							from: 1,
589							to: value*100,
590							speed: 3000
591						});
592					});
593
594				});
595				Self.appear(function () {					
596					Self.circleProgress({
597						value: value,
598						size: 170,
599						thickness: 20,
600						emptyFill: '#e7f0f8',
601						animation: {
602							duration: 3000
603						},
604						fill: {
605							color: color
606						}
607					});
608				});
609			});
610		};
611	}
612
613	$(document).ready(function() {
614      $('select:not(.ignore, .elementor-widget-fionca_policy select, .widget_archive select, .sidebar-categories select, .widget_text select, .wp-block-archives select, .wp-block-categories select)').niceSelect();
615    });
616
617    //Sortable Masonary with Filters
618	function enableMasonry() {
619		if($('.sortable-masonry').length){
620	
621			var winDow = $(window);
622			// Needed variables
623			var $container=$('.sortable-masonry .items-container');
624			var $filter=$('.filter-btns');
625	
626			$container.isotope({
627				filter:'*',
628				 masonry: {
629					columnWidth : '.masonry-item.small-column'
630				 },
631				animationOptions:{
632					duration:500,
633					easing:'linear'
634				}
635			});
636			
637			// Isotope Filter 
638			$filter.find('li').on('click', function(){
639				var selector = $(this).attr('data-filter');
640	
641				try {
642					$container.isotope({ 
643						filter	: selector,
644						animationOptions: {
645							duration: 500,
646							easing	: 'linear',
647							queue	: false
648						}
649					});
650				} catch(err) {
651	
652				}
653				return false;
654			});
655	
656			winDow.on('resize', function(){
657				var selector = $filter.find('li.active').attr('data-filter');
658
659				$container.isotope({ 
660					filter	: selector,
661					animationOptions: {
662						duration: 500,
663						easing	: 'linear',
664						queue	: false
665					}
666				});
667			});
668	
669			var filterItemA	= $('.filter-btns li');
670	
671			filterItemA.on('click', function(){
672				var $this = $(this);
673				if ( !$this.hasClass('active')) {
674					filterItemA.removeClass('active');
675					$this.addClass('active');
676				}
677			});
678		}
679	}
680	enableMasonry();
681	/*
682     * fionca Love It Plugin
683     */
684    $('.fionca_love_it').click(function (e) {
685		var post_id = parseInt($(this).attr('data-post-id'));
686		console.log(post_id);
687		var $this = $(this);
688        if (post_id > 0) {
689            jQuery.ajax({
690                type: "post",
691                dataType: "json",
692                url: fionca_love_it.ajaxurl,
693                data: {action: "fionca_love_it_ajax", post_id: post_id, nonce: fionca_love_it.nonce},
694                success: function (response) {
695                    if (response.type == 'success') {
696                        $this.find('span').html(response.count);
697                        $this.find('i').removeClass('fa-heart-o').addClass('fa-heart');
698                    }
699                }
700            });
701        }
702        e.preventDefault();
703        e.stopPropagation();
704	});
705	/*	=========================================================================
706	When document is Scrollig, do
707	========================================================================== */
708	jQuery(document).on('ready', function () {
709		(function ($) {
710			// add your functions
711			directionswitch();
712		})(jQuery);
713	});
714	/* ==========================================================================
715   When document is Scrollig, do
716   ========================================================================== */
717	$(window).on('scroll', function() {
718		headerStyle();
719	});
720	/* ==========================================================================
721   When document is loaded, do
722   ========================================================================== */
723	$(window).on('load', function() {
724		handlePreloader();
725		expertizeRoundCircle ();
726		enableMasonry();
727	});
728})(window.jQuery);

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.