1+ ( function ( $ ) {
2+ 'use strict' ;
3+
4+ // Preloader
5+ $ ( window ) . on ( 'load' , function ( ) {
6+ $ ( '#preloader' ) . delay ( 500 ) . fadeOut ( 500 ) ;
7+ } ) ;
8+
9+ // Button hover effect
10+ $ ( '.btn-hover' )
11+ . on ( 'mouseenter' , function ( e ) {
12+ const offset = $ ( this ) . offset ( ) ;
13+ const relX = e . pageX - offset . left ;
14+ const relY = e . pageY - offset . top ;
15+ $ ( this ) . find ( 'span' ) . css ( { top : relY , left : relX } ) ;
16+ } )
17+ . on ( 'mouseout' , function ( e ) {
18+ const offset = $ ( this ) . offset ( ) ;
19+ const relX = e . pageX - offset . left ;
20+ const relY = e . pageY - offset . top ;
21+ $ ( this ) . find ( 'span' ) . css ( { top : relY , left : relX } ) ;
22+ } ) ;
23+
24+ // Mobile menus
25+ $ ( '#mobile-menu' ) . meanmenu ( {
26+ meanMenuContainer : '.mobile-menu' ,
27+ meanScreenWidth : '991' ,
28+ meanExpand : [ '<i class="fas fa-plus"></i>' ] ,
29+ } ) ;
30+ $ ( '#mobile-menu-2' ) . meanmenu ( {
31+ meanMenuContainer : '.mobile-menu-2' ,
32+ meanScreenWidth : '4000' ,
33+ meanExpand : [ '<i class="fas fa-plus"></i>' ] ,
34+ } ) ;
35+
36+ // Sidebar
37+ $ ( '.offcanvas__close,.offcanvas__overlay' ) . on ( 'click' , function ( ) {
38+ $ ( '.offcanvas__info' ) . removeClass ( 'info-open' ) ;
39+ $ ( '.offcanvas__overlay' ) . removeClass ( 'overlay-open' ) ;
40+ } ) ;
41+ $ ( '.sidebar__toggle' ) . on ( 'click' , function ( ) {
42+ $ ( '.offcanvas__info' ) . addClass ( 'info-open' ) ;
43+ $ ( '.offcanvas__overlay' ) . addClass ( 'overlay-open' ) ;
44+ } ) ;
45+
46+ // Body overlay
47+ $ ( '.body-overlay' ) . on ( 'click' , function ( ) {
48+ $ ( '.offcanvas__area' ) . removeClass ( 'offcanvas-opened' ) ;
49+ $ ( '.df-search-area' ) . removeClass ( 'opened' ) ;
50+ $ ( '.body-overlay' ) . removeClass ( 'opened' ) ;
51+ } ) ;
52+
53+ // Sticky header
54+ $ ( window ) . on ( 'scroll' , function ( ) {
55+ $ ( '#header-sticky' ) . toggleClass ( 'sticky' , $ ( this ) . scrollTop ( ) > 250 ) ;
56+ } ) ;
57+
58+ // Data attributes
59+ $ ( '[data-background]' ) . each ( function ( ) {
60+ $ ( this ) . css ( 'background-image' , 'url(' + $ ( this ) . attr ( 'data-background' ) + ')' ) ;
61+ } ) ;
62+ $ ( '[data-width]' ) . each ( function ( ) {
63+ $ ( this ) . css ( 'width' , $ ( this ) . attr ( 'data-width' ) ) ;
64+ } ) ;
65+ $ ( '[data-bg-color]' ) . each ( function ( ) {
66+ $ ( this ) . css ( 'background-color' , $ ( this ) . attr ( 'data-bg-color' ) ) ;
67+ } ) ;
68+
69+ // Popups
70+ $ ( '.popup-image' ) . magnificPopup ( {
71+ type : 'image' ,
72+ gallery : { enabled : true } ,
73+ } ) ;
74+ $ ( '.popup-video' ) . magnificPopup ( { type : 'iframe' } ) ;
75+
76+ // Counters
77+ $ ( '.counter' ) . counterUp ( { delay : 10 , time : 1000 } ) ;
78+
79+ // AOS animations
80+ AOS . init ( { duration : 600 , easing : 'ease-in-out' , once : true , offset : 100 } ) ;
81+
82+ // Current year in footer
83+ const yearElement = document . getElementById ( 'current-year' ) ;
84+ if ( yearElement ) {
85+ yearElement . textContent = new Date ( ) . getFullYear ( ) ;
86+ }
87+
88+ // Back to top
89+ const progressPath = document . querySelector ( '.backtotop-wrap path' ) ;
90+ if ( progressPath ) {
91+ const pathLength = progressPath . getTotalLength ( ) ;
92+ progressPath . style . transition = progressPath . style . WebkitTransition = 'none' ;
93+ progressPath . style . strokeDasharray = pathLength + ' ' + pathLength ;
94+ progressPath . style . strokeDashoffset = pathLength ;
95+ progressPath . getBoundingClientRect ( ) ;
96+ progressPath . style . transition =
97+ progressPath . style . WebkitTransition = 'stroke-dashoffset 10ms linear' ;
98+ const updateProgress = function ( ) {
99+ const scroll = $ ( window ) . scrollTop ( ) ;
100+ const height = $ ( document ) . height ( ) - $ ( window ) . height ( ) ;
101+ const progress = pathLength - ( scroll * pathLength ) / height ;
102+ progressPath . style . strokeDashoffset = progress ;
103+ } ;
104+ updateProgress ( ) ;
105+ $ ( window ) . scroll ( updateProgress ) ;
106+ const offset = 150 ;
107+ const duration = 550 ;
108+ $ ( window ) . on ( 'scroll' , function ( ) {
109+ $ ( '.backtotop-wrap' ) . toggleClass ( 'active-progress' , $ ( this ) . scrollTop ( ) > offset ) ;
110+ } ) ;
111+ $ ( '.backtotop-wrap' ) . on ( 'click' , function ( event ) {
112+ event . preventDefault ( ) ;
113+ $ ( 'html, body' ) . animate ( { scrollTop : 0 } , duration ) ;
114+ } ) ;
115+ }
116+
117+ // Swiper sliders
118+ new Swiper ( '.testimonial-active-2' , {
119+ slidesPerView : 2 ,
120+ spaceBetween : 20 ,
121+ loop : true ,
122+ roundLengths : true ,
123+ autoplay : { delay : 3000 } ,
124+ pagination : { el : '.testimonial-swiper-dot' , clickable : true } ,
125+ navigation : {
126+ nextEl : '.testimonial-button-next' ,
127+ prevEl : '.testimonial-button-prev' ,
128+ } ,
129+ breakpoints : {
130+ 1400 : { slidesPerView : 2 } ,
131+ 1200 : { slidesPerView : 2 } ,
132+ 992 : { slidesPerView : 2 } ,
133+ 768 : { slidesPerView : 1 } ,
134+ 576 : { slidesPerView : 1 } ,
135+ 0 : { slidesPerView : 1 } ,
136+ } ,
137+ } ) ;
138+
139+ new Swiper ( '.brand-active' , {
140+ slidesPerView : 4 ,
141+ spaceBetween : 99 ,
142+ loop : true ,
143+ roundLengths : true ,
144+ autoplay : { delay : 3000 } ,
145+ breakpoints : {
146+ 1400 : { slidesPerView : 4 } ,
147+ 1200 : { slidesPerView : 3 } ,
148+ 992 : { slidesPerView : 3 } ,
149+ 768 : { slidesPerView : 2 } ,
150+ 576 : { slidesPerView : 2 } ,
151+ 0 : { slidesPerView : 1 } ,
152+ } ,
153+ speed : 1000 ,
154+ } ) ;
155+
156+ new Swiper ( '.project-active-1' , {
157+ slidesPerView : 2 ,
158+ spaceBetween : 30 ,
159+ loop : true ,
160+ autoplay : { delay : 2000 } ,
161+ navigation : {
162+ nextEl : '.project-1-button-next' ,
163+ prevEl : '.project-1-button-prev' ,
164+ } ,
165+ breakpoints : {
166+ 1400 : { slidesPerView : 4 } ,
167+ 1200 : { slidesPerView : 3 } ,
168+ 992 : { slidesPerView : 2 } ,
169+ 768 : { slidesPerView : 2 } ,
170+ 576 : { slidesPerView : 1 } ,
171+ 0 : { slidesPerView : 1 } ,
172+ } ,
173+ speed : 1000 ,
174+ } ) ;
175+
176+ new Swiper ( '.service-active-1' , {
177+ slidesPerView : 2 ,
178+ spaceBetween : 30 ,
179+ loop : true ,
180+ roundLengths : true ,
181+ autoplay : { delay : 2000 } ,
182+ navigation : {
183+ nextEl : '.service-1-button-next' ,
184+ prevEl : '.service-1-button-prev' ,
185+ } ,
186+ breakpoints : {
187+ 1400 : { slidesPerView : 2 } ,
188+ 1200 : { slidesPerView : 2 } ,
189+ 992 : { slidesPerView : 2 } ,
190+ 768 : { slidesPerView : 1 } ,
191+ 576 : { slidesPerView : 1 } ,
192+ 0 : { slidesPerView : 1 } ,
193+ } ,
194+ speed : 1500 ,
195+ } ) ;
196+
197+ if ( $ ( '.banner-active' ) . length > 0 ) {
198+ const sliderActive = '.banner-active' ;
199+ const sliderInit = new Swiper ( sliderActive , {
200+ slidesPerView : 1 ,
201+ slidesPerColumn : 1 ,
202+ paginationClickable : true ,
203+ fadeEffect : { crossFade : true } ,
204+ loop : true ,
205+ effect : 'fade' ,
206+ autoplay : { delay : 5000 } ,
207+ navigation : {
208+ nextEl : '.slider__button-next' ,
209+ prevEl : '.slider__button-prev' ,
210+ } ,
211+ pagination : { el : '.banner-dot' , clickable : true } ,
212+ a11y : false ,
213+ } ) ;
214+ const animate = function ( ) {
215+ $ ( sliderActive + ' [data-animation]' ) . each ( function ( ) {
216+ const anim = $ ( this ) . data ( 'animation' ) ;
217+ const delay = $ ( this ) . data ( 'delay' ) ;
218+ const duration = $ ( this ) . data ( 'duration' ) ;
219+ $ ( this )
220+ . removeClass ( 'anim' + anim )
221+ . addClass ( anim + ' animated' )
222+ . css ( {
223+ webkitAnimationDelay : delay ,
224+ animationDelay : delay ,
225+ webkitAnimationDuration : duration ,
226+ animationDuration : duration ,
227+ } )
228+ . one (
229+ 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend' ,
230+ function ( ) {
231+ $ ( this ) . removeClass ( anim + ' animated' ) ;
232+ }
233+ ) ;
234+ } ) ;
235+ } ;
236+ animate ( ) ;
237+ sliderInit . on ( 'slideChange' , function ( ) {
238+ $ ( sliderActive + ' [data-animation]' ) . removeClass ( 'animated' ) ;
239+ } ) ;
240+ sliderInit . on ( 'slideChange' , animate ) ;
241+ }
242+ } ) ( jQuery ) ;
0 commit comments