main.js 187 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029
  1. /* -------------------------------------------------------
  2. Theme Name: Crafto - The Multipurpose HTML5 Template
  3. Theme URL: https://craftohtml.themezaa.com/
  4. Description: Elevate your online presence with Crafto - a modern, versatile, multipurpose Bootstrap 5 responsive HTML5, SCSS template using highly creative 52+ ready demos.
  5. Author: ThemeZaa - https://www.themezaa.com/
  6. Author ThemeForest URL: https://themeforest.net/user/themezaa
  7. Copyright(c) 2025 themezaa.com
  8. Version: 3.0
  9. ------------------------------------------------------- */
  10. (function ($) {
  11. "use strict";
  12. /* ===================================
  13. Change variables value as per your need
  14. ====================================== */
  15. const {animate} = anime;
  16. var menuBreakPoint = 991;
  17. var sliderBreakPoint = 991; // It will effect when you have used attribute "data-thumb-slider-md-direction" OR "data-slider-md-direction"
  18. var animeBreakPoint = 1199;
  19. var headerTransition = 300; // Header transition effect time
  20. /* ===================================
  21. Touch device
  22. ====================================== */
  23. var isTouchDevice = (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
  24. if (isTouchDevice) {
  25. $('body').addClass('is-touchable');
  26. }
  27. /* ===================================
  28. Don't change variables value
  29. ====================================== */
  30. var lastScroll = 0,
  31. simpleDropdown = 0,
  32. linkDropdown = 0,
  33. isotopeObjs = [],
  34. swiperObjs = [];
  35. var windowScrollTop = window.pageYOffset || document.documentElement.scrollTop;
  36. /* ===================================
  37. Check for browser OS
  38. ====================================== */
  39. var isMobile = false,
  40. isiPhoneiPad = false,
  41. isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
  42. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  43. isMobile = true;
  44. }
  45. if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
  46. isiPhoneiPad = true;
  47. }
  48. /* ===================================
  49. jQuery appear
  50. ====================================== */
  51. $('.vertical-counter, .counter, .progress-bar, .pie-chart-style-01, .attractive-hover, .splitting-animation, .section-dark, footer, [data-anime], [data-fancy-text]').each(function () {
  52. $(this).appear().trigger('resize');
  53. });
  54. initScrollNavigate();
  55. slideboxstyle();
  56. animateCounters();
  57. setSpaceInTeamStyle();
  58. setSpaceInInteractiveBannerStyle();
  59. setOverLayerPosition();
  60. setBottomOverLayerPosition(2000);
  61. setupSwiper();
  62. /* ===================================
  63. Header
  64. ====================================== */
  65. // Mobile menu - modern style
  66. var mobileStyle = $('body').attr('data-mobile-nav-style');
  67. if ((mobileStyle == 'modern' || mobileStyle == 'full-screen-menu') && !$('.navbar-' + mobileStyle + '-inner').length) {
  68. if (!$('.box-layout').length && mobileStyle == 'modern') {
  69. $('section, footer').wrapAll('<div class="page-layout"></div>');
  70. } else {
  71. $('section').wrapAll('<div class="page-layout"></div>');
  72. }
  73. $('.navbar .navbar-toggler').clone(true).addClass('navbar-toggler-clone').insertAfter('.page-layout');
  74. $('.navbar .navbar-collapse').clone(true).addClass('navbar-collapse-clone').attr('id', 'navbarNav-clone').insertAfter('.page-layout');
  75. $('.navbar-toggler-clone, .navbar-collapse-clone').wrapAll('<div class="navbar-' + mobileStyle + '-inner"></div>');
  76. $('.navbar-toggler').attr('data-target', '#navbarNav-clone').attr('aria-controls', '#navbarNav-clone');
  77. $('.navbar-' + mobileStyle + '-inner').find('.dropdown-toggle').addClass('dropdown-toggle-clone');
  78. if (typeof $.fn.mCustomScrollbar === 'function') {
  79. if ($('.navbar-collapse-clone').length) {
  80. var scrollOptions = $('.navbar-collapse-clone').attr('data-scroll-options') || '{ "theme": "light" }';
  81. if (typeof (scrollOptions) !== 'undefined' && scrollOptions !== null) {
  82. scrollOptions = $.parseJSON(scrollOptions);
  83. $('.navbar-collapse-clone').mCustomScrollbar(scrollOptions);
  84. }
  85. }
  86. }
  87. if (mobileStyle == 'modern') {
  88. $('<div class="navbar-show-modern-bg"></div>').insertAfter('.page-layout');
  89. }
  90. }
  91. // Navbar collapse - classic menu
  92. $('.navbar-collapse.collapse').on('show.bs.collapse', function (e) {
  93. if (!$('body').hasClass('navbar-collapse-show')) {
  94. $('body').addClass('navbar-collapse-show');
  95. $('html').addClass('overflow-hidden');
  96. if ($('body').attr('data-mobile-nav-bg-color') && $('.navbar-modern-inner').length) {
  97. var bgColor = $('body').attr('data-mobile-nav-bg-color');
  98. $('.navbar-show-modern-bg').css('background', bgColor);
  99. }
  100. if ($('body').attr('data-mobile-nav-bg-color') && $('.navbar-full-screen-menu-inner').length) {
  101. var bgColor = $('body').attr('data-mobile-nav-bg-color');
  102. $('.navbar-full-screen-menu-inner').css('background', bgColor);
  103. }
  104. // Set submenu height after opened toggle menu
  105. if (getWindowWidth() <= menuBreakPoint) {
  106. var windowHeight = getWindowHeight(),
  107. headerHeight = getHeaderHeight();
  108. $('header .navbar-collapse').css('max-height', windowHeight - headerHeight);
  109. }
  110. } else {
  111. if ($('.navbar-modern-inner').length) {
  112. setTimeout(function () {
  113. $('.navbar-show-modern-bg').css('background', '');
  114. }, 600);
  115. }
  116. if ($('.navbar-full-screen-menu-inner').length) {
  117. setTimeout(function () {
  118. $('.navbar-full-screen-menu-inner').css('background', '');
  119. }, 600);
  120. }
  121. }
  122. var headerHeight = getHeaderHeight();
  123. var windowHeight = getWindowHeight();
  124. if ($('.navbar-modern-inner').length > 0 || $('.navbar-full-screen-menu-inner').length > 0) {
  125. $('.navbar-collapse-clone').css('max-height', windowHeight);
  126. } else {
  127. $('.navbar-collapse-clone').css('max-height', (windowHeight - headerHeight));
  128. }
  129. }).on('hide.bs.collapse', function (e) {
  130. if ($('body').hasClass('navbar-collapse-show')) {
  131. $('body').removeClass('navbar-collapse-show');
  132. $('html').removeClass('overflow-hidden');
  133. }
  134. });
  135. // Sub menu collapse event
  136. $('.sub-menu.collapse').on('show.bs.collapse', function (e) {
  137. var activeMenuId = $(e.target).attr('id');
  138. $('[data-bs-target="#' + activeMenuId + '"]').addClass('show');
  139. $(this).parents('.menu-item').siblings().each(function () {
  140. $('.sub-menu.show', this).collapse('hide');
  141. });
  142. stickyKitRecalc();
  143. }).on('hide.bs.collapse', function (e) {
  144. var activeMenuId = $(e.target).attr('id');
  145. $('[data-bs-target="#' + activeMenuId + '"]').removeClass('show');
  146. $(e.target).find('.sub-menu.show').collapse('hide');
  147. stickyKitRecalc();
  148. });
  149. // Search popup open
  150. $(document).on('click', '.search-form-icon', function (e) {
  151. e.preventDefault();
  152. $('body').addClass('show-search-popup');
  153. });
  154. // Search popup close
  155. $(document).on('click', '.search-close', function (e) {
  156. e.preventDefault();
  157. $('body').removeClass('show-search-popup');
  158. });
  159. // Search validation
  160. $(document).on('click', '.search-button', function () {
  161. var error = true;
  162. var formObj = $(this).parents('form');
  163. formObj.find('input[type=text]').each(function (index) {
  164. var _this = $(this),
  165. searchVal = _this.val();
  166. if (searchVal === null || searchVal === '') {
  167. formObj.find('input:eq(' + index + ')').addClass('search-error');
  168. error = false;
  169. } else {
  170. formObj.find('input:eq(' + index + ')').removeClass('search-error');
  171. }
  172. });
  173. return error;
  174. });
  175. // Header push menu open
  176. $(document).on('click', '.header-push-button .push-button', function () {
  177. $('html, body').toggleClass('show-menu');
  178. });
  179. // Header push menu close
  180. $(document).on('click', '.close-menu', function () {
  181. $('html, body').removeClass('show-menu');
  182. // Close left menu
  183. $('.sub-menu.show').collapse('hide');
  184. });
  185. // Close all left menu submenu
  186. $(document).on('click', '#navbar-menu .navbar-toggler', function () {
  187. // Close left menu
  188. $('.sub-menu.show').collapse('hide');
  189. });
  190. // Close on outside area
  191. $(document).on('click', 'body', function (e) {
  192. // Close all menu
  193. if (!($(e.target).closest('.navbar-nav').length || $(e.target).closest('.navbar-full-screen-menu-inner').length)) {
  194. setTimeout(function () {
  195. $('.navbar-collapse.collapse').collapse('hide');
  196. }, 100);
  197. }
  198. // Close push menu
  199. if (!($(e.target).hasClass('push-button') || $(e.target).closest('.push-button').length || $(e.target).closest('.push-menu').length || $(e.target).closest('.hamburger-menu').length)) {
  200. $('html, body').removeClass('show-menu');
  201. }
  202. // Close search
  203. if (!($(e.target).hasClass('search-form') || $(e.target).closest('.search-form-icon').length || $(e.target).closest('.search-form-box').length)) {
  204. $('body').removeClass('show-search-popup');
  205. }
  206. // Close dropdown menu, language and cart
  207. if (!$(e.target).closest('.navbar-nav').length) {
  208. if (!$(e.target).closest('.header-language').length) {
  209. // Close language menu
  210. $('.header-language').trigger('mouseleave');
  211. $('.header-language').removeClass('show');
  212. $('.header-language').children('.dropdown-menu').removeClass('show');
  213. }
  214. if (!$(e.target).closest('.header-cart').length) {
  215. // Close cart
  216. $('.header-cart').trigger('mouseleave');
  217. $('.header-cart').removeClass('show');
  218. $('.header-cart').children('.dropdown-menu').removeClass('show');
  219. }
  220. // Close all dropdown
  221. $('.navbar-nav .dropdown').each(function () {
  222. var _this = $(this);
  223. _this.trigger('mouseleave');
  224. _this.removeClass('show');
  225. _this.children('.dropdown-menu').removeClass('show');
  226. });
  227. } else if ($(e.target).parents('body').find('.header-language.open').length) {
  228. // Close language menu
  229. $('.header-language').trigger('mouseleave');
  230. $('.header-language').removeClass('show');
  231. $('.header-language').children('.dropdown-menu').removeClass('show');
  232. } else if ($(e.target).parents('body').find('.header-cart.open').length) {
  233. // Close cart
  234. $('.header-cart').trigger('mouseleave');
  235. $('.header-cart').removeClass('show');
  236. $('.header-cart').children('.dropdown-menu').removeClass('show');
  237. }
  238. // Close left-modern-header menu
  239. if (!$(e.target).closest('.left-modern-header').length) {
  240. $(".left-modern-header").collapse('hide');
  241. }
  242. });
  243. // Close on escape key
  244. $(document).on('keydown', function (e) {
  245. if (e.keyCode === 27) {
  246. // Close all menu
  247. $('.navbar-collapse.collapse').collapse('hide');
  248. // Close left menu
  249. $('#navbar-menu').collapse('hide');
  250. // Close push menu
  251. $('html, body').removeClass('show-menu');
  252. // Close search
  253. $('body').removeClass('show-search-popup');
  254. // Close left-modern-header menu
  255. $(".left-modern-header").collapse('hide');
  256. }
  257. });
  258. // Header submenu on hover
  259. $('.nav-item.submenu').on('mouseenter touchstart', function (e) {
  260. var _this = $(this),
  261. colorAttr = $('header nav').attr('data-header-hover');
  262. if (getWindowWidth() > menuBreakPoint) {
  263. if ($(e.target).siblings('.dropdown-menu').length) {
  264. e.preventDefault();
  265. }
  266. if (colorAttr == 'light') {
  267. $('header nav').addClass('submenu-light').removeClass('submenu-dark');
  268. } else if (colorAttr == 'dark') {
  269. $('header nav').addClass('submenu-dark').removeClass('submenu-light');
  270. }
  271. }
  272. }).on('mouseleave', function (e) {
  273. var _this = $(this);
  274. $('header nav').removeClass('submenu-light').removeClass('submenu-dark');
  275. });
  276. // Open menu on hover
  277. $('.dropdown').on('mouseenter touchstart', function (e) {
  278. var _this = $(this);
  279. _this.siblings('.dropdown').removeClass('open');
  280. _this.parents('.navbar-nav').siblings('.navbar-nav').find('.dropdown').removeClass('open');
  281. if (getWindowWidth() >= menuBreakPoint) {
  282. if (_this.hasClass('open') && _this[0] == $(e.target).parent()[0]) {
  283. let href = $(_this).find('.nav-link').attr('href');
  284. if (href != 'undefined' && href.indexOf('javascript') === -1 && typeof undefined !== typeof href && href != '#') {
  285. window.location.href = href;
  286. }
  287. }
  288. }
  289. _this.addClass('open');
  290. menuPosition(_this);
  291. if (getWindowWidth() > menuBreakPoint) {
  292. if ($(e.target).siblings('.dropdown-menu').length) {
  293. e.preventDefault();
  294. }
  295. // Header color remove click on simple dropdown menu
  296. if ($(e.target).hasClass('simple-dropdown') || $(e.target).closest('.simple-dropdown').length) {
  297. $('header nav').removeClass('submenu-light').removeClass('submenu-dark');
  298. }
  299. }
  300. }).on('mouseleave', function (e) {
  301. var _this = $(this);
  302. _this.removeClass('menu-left');
  303. _this.removeClass('open');
  304. });
  305. // Add active class to current menu
  306. var pgurl = window.location.href.substr(window.location.href.lastIndexOf('/') + 1);
  307. var $hash = window.location.hash.substring(1);
  308. if ($hash) {
  309. $hash = '#' + $hash;
  310. pgurl = pgurl.replace($hash, '');
  311. } else {
  312. pgurl = pgurl.replace('#', '');
  313. }
  314. $('.navbar-nav li a, .menu-item-list a').each(function () {
  315. var _this = $(this),
  316. aHref = _this.attr('href');
  317. if (aHref === pgurl || aHref === pgurl + '.html') {
  318. _this.parent().addClass('active');
  319. _this.parents('li.dropdown').addClass('active');
  320. _this.parents('li.menu-item').addClass('active');
  321. }
  322. });
  323. // Sticky left menu
  324. if ($.fn.stick_in_parent !== undefined && $.fn.stick_in_parent !== null) {
  325. if ($('.left-sidebar-wrapper').length) {
  326. $('.left-sidebar-wrapper .left-sidebar-nav').stick_in_parent({
  327. recalc: 1
  328. });
  329. }
  330. }
  331. if (typeof $.fn.smoothScroll === 'function') {
  332. if ($('.header-reverse').length > 0) {
  333. $('.inner-link').smoothScroll({
  334. speed: 800,
  335. offset: -59,
  336. beforeScroll: function () {
  337. if ($('body').hasClass('left-menu-onepage')) {
  338. $('.left-modern-header').collapse('hide');
  339. }
  340. $('.navbar-collapse.collapse').collapse('hide');
  341. }
  342. });
  343. } else {
  344. if ($('.inner-link').length > 0) {
  345. var offset = 0
  346. if ($('nav.navbar').hasClass('disable-fixed')) {
  347. offset = 1;
  348. }
  349. if ($('.left-modern-menu').hasClass('left-menu-onepage')) {
  350. if (getWindowWidth() <= menuBreakPoint) {
  351. offset = -59;
  352. }
  353. }
  354. $('.inner-link').smoothScroll({
  355. speed: 800,
  356. offset: offset,
  357. beforeScroll: function () {
  358. if ($('body').hasClass('left-menu-onepage')) {
  359. $('.left-modern-header').collapse('hide');
  360. }
  361. if ($('body').hasClass('show-menu')) {
  362. $('html, body').removeClass('show-menu');
  363. }
  364. $('.navbar-collapse.collapse').collapse('hide');
  365. }
  366. });
  367. }
  368. }
  369. // Section link
  370. if ($('.section-link').length > 0) {
  371. $('.section-link').smoothScroll({
  372. speed: 900,
  373. offset: 1,
  374. beforeScroll: function () {
  375. $('.navbar-collapse.collapse').collapse('hide');
  376. }
  377. });
  378. }
  379. }
  380. $('.modern-side-menu .menu-item').on('click', function () {
  381. $('.modern-side-menu .menu-item').removeClass('active');
  382. $(this).addClass('active');
  383. });
  384. // Get top space header height
  385. function getHeaderHeight() {
  386. var headerHeight = 0;
  387. if ($('.header-top-bar').length) {
  388. headerHeight = headerHeight + $('.header-top-bar').outerHeight();
  389. }
  390. if ($('header nav.navbar').length) {
  391. headerHeight = headerHeight + $('header nav.navbar').outerHeight();
  392. }
  393. if ($('.left-modern-header .left-modern-sidebar').length) {
  394. headerHeight = headerHeight + $('.left-modern-header .left-modern-sidebar').outerHeight();
  395. }
  396. return headerHeight;
  397. }
  398. // Get top space height
  399. function setTopSpaceHeight() {
  400. if (!$('header').hasClass('sticky') && ($('.top-space-margin').length || $('.top-space-padding').length) || $('.ipad-top-space-margin').length) {
  401. var headerHeight = getHeaderHeight();
  402. if ($('.top-space-margin').length) {
  403. $('.top-space-margin').css('margin-top', headerHeight);
  404. }
  405. if ($('.top-space-padding').length) {
  406. $('.top-space-padding').css('padding-top', headerHeight);
  407. }
  408. if ($('.ipad-top-space-margin').length) {
  409. if (getWindowWidth() <= menuBreakPoint) {
  410. $('.ipad-top-space-margin').css('margin-top', headerHeight);
  411. } else {
  412. $('.ipad-top-space-margin').css('margin-top', 'inherit');
  413. }
  414. }
  415. }
  416. }
  417. // Menu position
  418. function menuPosition(element) {
  419. var windowWidth = getWindowWidth();
  420. if (element.hasClass('simple-dropdown')) {
  421. simpleDropdown = element;
  422. linkDropdown = element.find('a.nav-link');
  423. var menuSpacing = 30,
  424. menuLeftPosition = element.offset().left,
  425. menuWidth = element.children('.dropdown-menu').outerWidth(),
  426. menuDropdownCSS = (windowWidth - menuSpacing) - (menuLeftPosition + menuWidth);
  427. if (menuDropdownCSS < 0) {
  428. element.children('.dropdown-menu').css('left', menuDropdownCSS);
  429. }
  430. }
  431. if (element.parent().hasClass('dropdown-menu') && element.parents('.simple-dropdown')) {
  432. var dropdownWidth = 0,
  433. maxValueInArray = 0,
  434. lastValue = 0,
  435. multiDepth = 0;
  436. dropdownWidth = element.outerWidth() - linkDropdown.outerWidth();
  437. element.children('.dropdown-menu').each(function () {
  438. var arr = [];
  439. if (element.find('li').hasClass('dropdown')) {
  440. dropdownWidth = dropdownWidth + element.outerWidth();
  441. element.find('li.dropdown').each(function () {
  442. var dropdownMenu = element.closest('.dropdown-menu');
  443. arr.push(dropdownMenu.outerWidth());
  444. });
  445. maxValueInArray = lastValue + Math.max.apply(Math, arr);
  446. lastValue = maxValueInArray;
  447. dropdownWidth = dropdownWidth + maxValueInArray;
  448. multiDepth = multiDepth + 1;
  449. } else if (multiDepth < 1) {
  450. dropdownWidth = dropdownWidth + element.outerWidth();
  451. }
  452. });
  453. var menuRightPosition = windowWidth - (simpleDropdown.offset().left + simpleDropdown.outerWidth());
  454. if (dropdownWidth > menuRightPosition) {
  455. if (element.find('.dropdown-menu').length > 0) {
  456. var menuTopPosition = element.position().top,
  457. submenuObj = element.find('.dropdown-menu'),
  458. submenuHeight = submenuObj.outerHeight(),
  459. totalHeight = menuTopPosition + submenuHeight + getHeaderHeight(),
  460. windowHeight = getWindowHeight();
  461. if (totalHeight > windowHeight) {
  462. submenuObj.css('top', '-' + (totalHeight - windowHeight) + 'px');
  463. }
  464. }
  465. element.addClass('menu-left');
  466. }
  467. }
  468. }
  469. // Recalculate sticky kit
  470. function stickyKitRecalc() {
  471. if ($('.left-sidebar-wrapper').length) {
  472. setTimeout(function () {
  473. $('.left-sidebar-wrapper').trigger('sticky_kit:recalc');
  474. }, 500);
  475. }
  476. }
  477. // Without link
  478. $('.nav-item .nav-link').on('click', function (e) {
  479. var submenuLenth = $(this).closest('.dropdown').find('.dropdown').length;
  480. if ($(window).width() < 992 && $(this).closest('.dropdown').length > 0) {
  481. var HasClass = $(this).closest('.nav-item').find('.dropdown-menu').hasClass('show');
  482. if ($(this).closest('.nav-item').find('.dropdown-menu').hasClass('show')) {
  483. $(this).closest('.nav-item').find('.dropdown-menu').removeClass('show')
  484. $(this).closest('.nav-item').find('.dropdown-toggle').removeClass('show')
  485. } else {
  486. $('.navbar-nav').find('.dropdown-menu').removeClass('show');
  487. $('.navbar-nav').find('.dropdown-toggle').removeClass('show');
  488. $(this).closest('.nav-item').find('.dropdown-menu').addClass('show')
  489. $(this).closest('.nav-item').find('.dropdown-toggle').addClass('show')
  490. }
  491. }
  492. });
  493. $(window).resize(function () {
  494. if ($(window).width() > 991) {
  495. $('.navbar-nav').find('.dropdown-menu').removeClass('show');
  496. $('.navbar-nav').find('.dropdown-toggle').removeClass('show');
  497. }
  498. });
  499. /* ===================================
  500. Custom scrollbar
  501. ====================================== */
  502. if (typeof $.fn.mCustomScrollbar === 'function') {
  503. $('[data-scroll-options]').each(function () {
  504. var _this = $(this);
  505. var scrollOptions = _this.data('scroll-options') || '{"theme": "dark"}';
  506. try {
  507. _this.mCustomScrollbar(scrollOptions);
  508. } catch (error) {
  509. console.error('Error parsing scroll options:', error);
  510. }
  511. });
  512. }
  513. /* ===================================
  514. Portfolio
  515. ====================================== */
  516. // Portfolio isotope filter
  517. if (typeof imagesLoaded === 'function') {
  518. $('.portfolio-wrapper, .shop-wrapper').each(function () {
  519. var _this = $(this);
  520. _this.imagesLoaded(function () {
  521. _this.removeClass('grid-loading');
  522. if (typeof $.fn.isotope === 'function') {
  523. var _thisIsotop = _this.isotope({
  524. layoutMode: 'masonry',
  525. itemSelector: '.grid-item',
  526. percentPosition: true,
  527. stagger: 0,
  528. masonry: {
  529. columnWidth: '.grid-sizer',
  530. }
  531. });
  532. }
  533. isotopeObjs.push(_this);
  534. // Filter default on load
  535. if (typeof $.fn.isotope === 'function') {
  536. var currentPortfolioActive = $('.portfolio-filter > li.active > a').attr('data-filter');
  537. if (currentPortfolioActive != '' && currentPortfolioActive != undefined) {
  538. _this.isotope({filter: currentPortfolioActive});
  539. }
  540. }
  541. });
  542. _this.on('arrangeComplete', function () {
  543. reInitSkrollr();
  544. });
  545. $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
  546. _this.isotope({transitionDuration: 0});
  547. });
  548. });
  549. }
  550. $(document).on('click', '.portfolio-filter > li > a', function () {
  551. var _this = $(this),
  552. parentSectionObj = _this.parents('section');
  553. parentSectionObj.find('.portfolio-filter > li').removeClass('active');
  554. _this.parent().addClass('active');
  555. var selector = _this.attr('data-filter'),
  556. portfolioFilter = parentSectionObj.find('.portfolio-wrapper');
  557. portfolioFilter.find('.grid-item[data-anime]').addClass('appear');
  558. if (typeof portfolioFilter.isotope === 'function') {
  559. portfolioFilter.isotope({filter: selector});
  560. }
  561. if (parentSectionObj.length && $(parentSectionObj).hasClass('overlap-height')) {
  562. setOverLayerPosition();
  563. }
  564. return false;
  565. });
  566. // Reset isotope loop
  567. function resetIsotopeLayoutLoop(isotopeObjs, removeAnimation) {
  568. for (var i = 0; i < isotopeObjs.length; i++) {
  569. if (isotopeObjs[i].data('isotope')) {
  570. isotopeObjs[i].isotope('layout');
  571. }
  572. }
  573. ;
  574. }
  575. // Horizontal portfolio
  576. const ThreeDLetterMenuEffect = () => {
  577. $(".threeD-letter-menu .menu-item").each(function () {
  578. let _self = this,
  579. MenuLink = _self.querySelector(".menu-item-text"),
  580. MenuText = MenuLink.querySelector("span"),
  581. imgHeight = _self.querySelector(".hover-reveal").clientHeight,
  582. imgWidth = _self.querySelector(".hover-reveal").clientWidth,
  583. windowHeight = window.innerHeight,
  584. windowWidth = window.innerWidth;
  585. MenuLink.innerHTML = `<span>${MenuText.innerHTML}</span><span class="clone">${MenuText.innerHTML}</span>`
  586. MenuLink.querySelectorAll("span").forEach(function (item) {
  587. item.setAttribute("data-splitting", true);
  588. Splitting();
  589. });
  590. _self.addEventListener("mouseenter", function () {
  591. animate(_self.querySelector(".hover-reveal"), {
  592. opacity: [0, 1],
  593. duration: 1000,
  594. ease: "OutQuad"
  595. })
  596. animate(_self.querySelector(".hover-reveal__inner"), {
  597. scale: [0.5, 1],
  598. ease: "OutQuad"
  599. })
  600. animate(_self.querySelector(".hover-reveal__img"), {
  601. scale: [2, 1],
  602. ease: "OutQuad"
  603. })
  604. })
  605. _self.addEventListener("mouseleave", function () {
  606. animate(_self.querySelector(".hover-reveal"), {
  607. opacity: 0,
  608. duration: 1000,
  609. ease: "OutQuad"
  610. })
  611. animate(_self.querySelector(".hover-reveal__inner"), {
  612. scale: [1, 0.5],
  613. ease: "OutQuad"
  614. })
  615. animate(_self.querySelector(".hover-reveal__img"), {
  616. scale: [1, 2],
  617. ease: "OutQuad"
  618. })
  619. })
  620. if (typeof TweenLite !== "undefined") {
  621. document.addEventListener("mousemove", function (e) {
  622. let posX = e.clientX + 20,
  623. posY = e.clientY + 20;
  624. TweenLite.to(_self.querySelector(".hover-reveal"), .6, {
  625. x: posX + imgWidth > windowWidth ? e.clientX - imgWidth : posX,
  626. y: posY + imgHeight > windowHeight ? e.clientY - imgHeight : posY,
  627. })
  628. })
  629. }
  630. });
  631. }
  632. ThreeDLetterMenuEffect();
  633. // Crafto reveal box
  634. const hoverItem = document.querySelectorAll(".reveal-item-hover");
  635. function revealImage(e, hoverItem) {
  636. const item = hoverItem.getBoundingClientRect();
  637. const reveal = hoverItem.querySelector('.hover-reveal');
  638. if (!reveal)
  639. return;
  640. const revealWidth = reveal.offsetWidth;
  641. const revealHeight = reveal.offsetHeight;
  642. const x = e.clientX - item.left - revealWidth / 2;
  643. const y = e.clientY - item.top - revealHeight / 2;
  644. $(hoverItem).find('.hover-reveal').css('transform', `translate(${x}px, ${y}px)`);
  645. }
  646. hoverItem.forEach((item, i) => {
  647. item.addEventListener("mousemove", (e) => {
  648. setInterval(revealImage(e, item), 150);
  649. });
  650. });
  651. // Minimal portfolio
  652. const sticky_container = document.querySelector(".sticky-image-distortion-wrapper");
  653. if (typeof (sticky_container) != 'undefined' && sticky_container != null) {
  654. let winsize;
  655. const calcWinsize = () => winsize = {width: window.innerWidth, height: window.innerHeight};
  656. calcWinsize();
  657. window.addEventListener('resize', calcWinsize);
  658. class Menu {
  659. constructor() {
  660. this.DOM = {
  661. menu: document.querySelector('.sticky-image-distortion-wrapper nav.menu')
  662. };
  663. this.DOM.menuLinks = [...this.DOM.menu.querySelectorAll('.menu__link')];
  664. this.mousePos = {x: winsize.width / 2, y: winsize.height / 2};
  665. this.lastMousePos = {
  666. translation: {x: winsize.width / 2, y: winsize.height / 2},
  667. displacement: {x: 0, y: 0}
  668. };
  669. this.dmScale = 0;
  670. this.current = -1;
  671. this.initEvents();
  672. requestAnimationFrame(() => this.render());
  673. }
  674. initEvents() {
  675. document.body.style.setProperty('--body-bgcolor', this.DOM.menuLinks[0].getAttribute("data-bg"))
  676. let active_item;
  677. this.DOM.menuLinks.forEach((item, i) => {
  678. let imgPath = item.getAttribute('data-img');
  679. let bgColor = item.getAttribute('data-bg');
  680. item.querySelector(".svg-wrapper").innerHTML = `
  681. <svg class="distort" width="960" height="980" viewBox="0 0 960 980">
  682. <filter id="distortionFilter${i}">
  683. <feTurbulence type="fractalNoise" baseFrequency="0.01 0.003" numOctaves="5" seed="2" stitchTiles="noStitch" x="0%" y="0%" width="100%" height="100%" result="noise"/>
  684. <feDisplacementMap in="SourceGraphic" in2="noise" scale="0" xChannelSelector="R" yChannelSelector="B" x="0%" y="0%" width="100%" height="100%" filterUnits="userSpaceOnUse"/>
  685. </filter>
  686. <g filter="url(#distortionFilter${i})">
  687. <image class="distort__img" x="80" y="0" xlink:href="${imgPath}" height="980" width="960" />
  688. </g>
  689. </svg>
  690. `
  691. const displaceMentEl = [...item.querySelectorAll('feDisplacementMap')]
  692. item.addEventListener('mouseenter', (e) => {
  693. item.closest(".menu").childNodes.forEach(item => item.classList && item.classList.remove("active"))
  694. item.classList.add("active");
  695. if (typeof TweenMax !== 'undefined' && typeof TweenMax !== null) {
  696. if (item !== active_item) {
  697. TweenMax.fromTo(displaceMentEl, 1.2, {attr: {scale: 50}}, {attr: {scale: 0.3}});
  698. }
  699. }
  700. document.body.style.setProperty('--body-bgcolor', bgColor)
  701. active_item = item;
  702. });
  703. item.addEventListener('mouseleave', (e) => {
  704. active_item = item;
  705. })
  706. });
  707. }
  708. render() {
  709. requestAnimationFrame(() => this.render());
  710. }
  711. }
  712. new Menu();
  713. }
  714. /* ===================================
  715. Blog
  716. ====================================== */
  717. // Blog isotope filter
  718. if (typeof imagesLoaded === 'function') {
  719. $('.blog-wrapper').each(function () {
  720. var _this = $(this);
  721. _this.imagesLoaded(function () {
  722. _this.removeClass('grid-loading');
  723. if (typeof $.fn.isotope === 'function') {
  724. _this.isotope({
  725. layoutMode: 'masonry',
  726. itemSelector: '.grid-item',
  727. percentPosition: true,
  728. stagger: 0,
  729. masonry: {
  730. columnWidth: '.grid-sizer',
  731. }
  732. });
  733. }
  734. isotopeObjs.push(_this);
  735. var currentBlogActive = $('.blog-filter > li.active > a').attr('data-filter');
  736. if (currentBlogActive != '' && currentBlogActive != undefined) {
  737. _this.isotope({filter: currentBlogActive});
  738. }
  739. });
  740. });
  741. }
  742. $(document).on('click', '.blog-filter > li > a', function () {
  743. var _this = $(this),
  744. parentSectionObj = _this.parents('section');
  745. parentSectionObj.find('.blog-filter > li').removeClass('active');
  746. _this.parent().addClass('active');
  747. var selector = _this.attr('data-filter'),
  748. blogFilter = parentSectionObj.find('.blog-wrapper');
  749. blogFilter.find('.grid-item[data-anime]').addClass('appear');
  750. blogFilter.isotope({filter: selector});
  751. return false;
  752. });
  753. // blog hover box
  754. $('.box-hover').on('mouseenter', function (e) {
  755. $(this).find('.hover-text').slideDown(400);
  756. }).on('mouseleave', function (e) {
  757. $(this).find('.hover-text').slideUp(400);
  758. });
  759. /* ===================================
  760. Image gallery
  761. ====================================== */
  762. // Image gallery isotope filter
  763. if (typeof imagesLoaded === 'function') {
  764. $('.gallery-wrapper').each(function () {
  765. var _this = $(this);
  766. _this.imagesLoaded(function () {
  767. _this.removeClass('grid-loading');
  768. if (typeof $.fn.isotope === 'function') {
  769. _this.isotope({
  770. layoutMode: 'masonry',
  771. itemSelector: '.grid-item',
  772. percentPosition: true,
  773. stagger: 0,
  774. masonry: {
  775. columnWidth: '.grid-sizer',
  776. }
  777. });
  778. }
  779. isotopeObjs.push(_this);
  780. });
  781. });
  782. }
  783. // Group gallery light box
  784. if (typeof $.fn.magnificPopup === 'function') {
  785. var lightboxgallerygroups = {};
  786. $('.portfolio-box [data-group], .gallery-box [data-group]').each(function () {
  787. var id = $(this).attr('data-group');
  788. if (!lightboxgallerygroups[id]) {
  789. lightboxgallerygroups[id] = [];
  790. }
  791. lightboxgallerygroups[id].push(this);
  792. });
  793. $.each(lightboxgallerygroups, function () {
  794. $(this).magnificPopup({
  795. type: 'image',
  796. closeOnContentClick: true,
  797. closeBtnInside: false,
  798. gallery: {enabled: true}
  799. });
  800. });
  801. }
  802. /* ===================================
  803. Justified gallery
  804. ====================================== */
  805. if (typeof imagesLoaded === 'function') {
  806. if ($('.justified-gallery').length) {
  807. $('.justified-gallery').each(function () {
  808. var _this = $(this),
  809. justifiedOptions = _this.attr('data-justified-options') || '{ "rowHeight": 400, "maxRowHeight": false, "captions": true, "margins": 10, "waitThumbnailsLoad": true }';
  810. if (typeof $.fn.justifiedGallery !== 'undefined') {
  811. if (typeof (justifiedOptions) !== 'undefined' && justifiedOptions !== null) {
  812. _this.imagesLoaded(function () {
  813. justifiedOptions = $.parseJSON(justifiedOptions);
  814. _this.justifiedGallery(justifiedOptions);
  815. });
  816. }
  817. }
  818. });
  819. }
  820. }
  821. /* ===================================
  822. Accordion
  823. ====================================== */
  824. $('.accordion').each(function () {
  825. var _this = $(this),
  826. activeIconClass = _this.attr('data-active-icon') || '',
  827. inactiveIconClass = _this.attr('data-inactive-icon') || '';
  828. $('.collapse', this).on('show.bs.collapse', function () {
  829. var id = $(this).attr('id');
  830. $('a[data-bs-target="#' + id + '"]').closest('.accordion-header').parent('.accordion-item').addClass('active-accordion');
  831. $('a[data-bs-target="#' + id + '"] i').addClass(activeIconClass).removeClass(inactiveIconClass);
  832. }).on('hide.bs.collapse', function () {
  833. var id = $(this).attr('id');
  834. $('a[data-bs-target="#' + id + '"]').closest('.accordion-header').parent('.accordion-item').removeClass('active-accordion');
  835. $('a[data-bs-target="#' + id + '"] i').addClass(inactiveIconClass).removeClass(activeIconClass);
  836. });
  837. });
  838. // Accordion on checkout page
  839. $('.checkout-accordion label input').on('click', function (e) {
  840. var collapseId = $(this).parent().find('a').attr('href');
  841. if ($(this).prop("checked")) {
  842. $(collapseId).collapse('show');
  843. } else {
  844. $(collapseId).collapse('hide');
  845. }
  846. });
  847. /* ===================================
  848. Progress bar
  849. ====================================== */
  850. if ($('.progress-bar').length) {
  851. $(document).on('appear', '.progress-bar', function (e) {
  852. if (!$(this).hasClass('appear')) {
  853. $(this).addClass('appear');
  854. var total = $(this).attr('aria-valuenow'), delay = 300;
  855. $(this).animate({'width': total + '%'}, {
  856. duration: delay,
  857. ease: "swing",
  858. progress: function (animation, progress, msRemaining) {
  859. var counter = parseInt(total * progress);
  860. $(this).find('span').html(counter + '%');
  861. }
  862. });
  863. }
  864. });
  865. }
  866. $('[data-tab="review-tab"]').on('shown.bs.tab', function (e) {
  867. $('.progress-bar').each(function () {
  868. $(this).appear().trigger('resize');
  869. });
  870. });
  871. /* ===================================
  872. Pie charts
  873. ====================================== */
  874. // Pie charts style 01
  875. if ($('.pie-chart-style-01').length) {
  876. if (typeof $.fn.easyPieChart === 'function') {
  877. var color1, color2;
  878. $(document.body).on('appear', '.pie-chart-style-01', function (e) {
  879. $('.pie-chart-style-01').easyPieChart({
  880. trackColor: '#232323',
  881. scaleColor: "",
  882. lineCap: 'round',
  883. lineWidth: 10,
  884. size: 180,
  885. barColor: function () {
  886. color1 = $(this.el).attr('data-start-color') || $(this.el).attr('data-bar-color') || "#000";
  887. color2 = $(this.el).attr('data-end-color') || $(this.el).attr('data-bar-color') || "#000";
  888. var ctx = this.renderer.getCtx();
  889. var canvas = this.renderer.getCanvas();
  890. var gradient = ctx.createLinearGradient(0, 0, canvas.width, 270);
  891. gradient.addColorStop(0.2, color1);
  892. gradient.addColorStop(0, color2);
  893. return gradient;
  894. },
  895. animate: {
  896. duration: 2000,
  897. enabled: true
  898. },
  899. onStep: function (from, to, percent) {
  900. $(this.el).find('.percent').text(Math.round(percent) + '%');
  901. }
  902. });
  903. });
  904. }
  905. }
  906. /* ===================================
  907. Mousetip on mouse move
  908. ====================================== */
  909. if (!isMobile) {
  910. $(document).on('mousemove', '.mousetip-wrapper', function (e) {
  911. var mouseX = e.pageX - $(this).offset().left + 20;
  912. var mouseY = e.pageY - $(this).offset().top + 20;
  913. $(this).find('.caption').show().css({
  914. top: mouseY, left: mouseX
  915. });
  916. });
  917. }
  918. /* ===================================
  919. Counter
  920. ====================================== */
  921. // Vertical counter
  922. $('.vertical-counter').each(function () {
  923. var _this = $(this),
  924. counterValue = _this.attr('data-to'),
  925. individualValue = counterValue.toString().split(''),
  926. valueLength = counterValue.length;
  927. // Adding the div.vertical-counter-number in div.counter multiple(valueLength) times
  928. for (var i = 0; i < valueLength; i++) {
  929. _this.append('<span class="vertical-counter-number"><ul><li>0</li><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li></ul></span>');
  930. }
  931. // Adding the individual data-to in each div.vertical-counter-number
  932. _this.find('.vertical-counter-number').each(function (index) {
  933. $(this).attr('data-to', individualValue[index]);
  934. });
  935. });
  936. // Vertical counter on jQuery appear
  937. if ($('.vertical-counter').length) {
  938. function calculateHeight() {
  939. $('.vertical-counter').each(function () {
  940. var _this = $(this),
  941. divHeight = _this.find('.vertical-counter-number').find('li').height();
  942. $(this).height(divHeight);
  943. });
  944. }
  945. calculateHeight();
  946. $(window).resize(function () {
  947. calculateHeight();
  948. })
  949. $(document).on('appear', '.vertical-counter', function (e) {
  950. if (!$(this).hasClass('appear')) {
  951. $(this).addClass('appear');
  952. if ($(window).scrollTop() + getWindowHeight() >= $('.vertical-counter').offset().top) {
  953. $(this).find('.vertical-counter-number').each(function () {
  954. var _this = $(this),
  955. value = _this.attr('data-to');
  956. if (value <= 9) {
  957. animate(this.querySelector('ul'), {
  958. translateY: [0, `${-value * 10}%`],
  959. duration: 2000,
  960. ease: 'OutCubic'
  961. });
  962. }
  963. });
  964. }
  965. }
  966. });
  967. $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
  968. let activeTabPane = $(`${$(this).attr('href')}`);
  969. activeTabPane.find('.vertical-counter').each(function () {
  970. var _this = $(this),
  971. value = _this.attr('data-to'),
  972. divHeight = _this.find('li').height();
  973. _this.height(divHeight);
  974. if (value <= 9) {
  975. _this.find('ul').css({'transform': 'translateY(-' + value * 10 + '%)'});
  976. }
  977. });
  978. });
  979. }
  980. $('[data-tab="counter"]').on('shown.bs.tab', function (e) {
  981. $('.vertical-counter').each(function () {
  982. $(this).appear().trigger('resize');
  983. });
  984. });
  985. // Counter number reset on jQuery appear
  986. if (typeof $.fn.countTo === 'function' && $('.counter').length) {
  987. $(document).on('appear', '.counter', function (e) {
  988. var _this = $(this);
  989. if (!_this.hasClass('appear')) {
  990. var options = _this.data('countToOptions') || {};
  991. _this.countTo(options);
  992. _this.addClass('appear');
  993. }
  994. });
  995. }
  996. // Counter
  997. function animateCounters() {
  998. $('.counter').each(function (options) {
  999. var _this = $(this);
  1000. options = $.extend({}, options || {}, _this.data('countToOptions') || {});
  1001. if (typeof $.fn.countTo === 'function') {
  1002. _this.countTo(options);
  1003. }
  1004. });
  1005. }
  1006. /* ===================================
  1007. Sliding box
  1008. ====================================== */
  1009. function slideboxstyle() {
  1010. $('.sliding-box').each(function (index, value) {
  1011. var valueObj = $(value),
  1012. totalWidth = valueObj.outerWidth(),
  1013. slidingLength = valueObj.find('.sliding-box-item').length,
  1014. devideRightPadding = parseInt(valueObj.css('padding-right')) / slidingLength,
  1015. devideLeftPadding = parseInt(valueObj.css('padding-left')) / slidingLength,
  1016. usageWidth = (slidingLength * 30) + 30 + devideRightPadding + devideLeftPadding,
  1017. useWidth = totalWidth - usageWidth,
  1018. devideLength = slidingLength + 1,
  1019. devideWidth = (useWidth / devideLength),
  1020. activeWidth = devideWidth * 2;
  1021. valueObj.find('.sliding-box-item, .sliding-box-img, .sliding-box-item .sliding-box-content').css('width', devideWidth);
  1022. valueObj.find('.sliding-box-item .sliding-box-content').css('left', devideWidth);
  1023. valueObj.find('.sliding-box-item.active').css('width', activeWidth);
  1024. $(document).on('mouseenter', '.sliding-box .sliding-box-item', function () {
  1025. $(this).siblings().removeClass('active');
  1026. $(this).addClass('active');
  1027. valueObj.find('.sliding-box-item, .sliding-box-img, .sliding-box-item .sliding-box-content').css('width', devideWidth);
  1028. valueObj.find('.sliding-box-item .sliding-box-content').css('left', devideWidth);
  1029. valueObj.find('.sliding-box-item.active').css('width', activeWidth);
  1030. });
  1031. });
  1032. }
  1033. /* ===================================
  1034. Team
  1035. ====================================== */
  1036. // Team style 01
  1037. function setSpaceInTeamStyle() {
  1038. $('.team-style-01').each(function () {
  1039. let _this = $(this),
  1040. figure = _this.find('figure'),
  1041. figcaption = _this.find('figcaption');
  1042. setTimeout(function () {
  1043. figure.css({'padding-bottom': figcaption.outerHeight()});
  1044. }, 200);
  1045. });
  1046. }
  1047. /* ===================================
  1048. Interactive banner
  1049. ====================================== */
  1050. // Interactive banner style 02
  1051. function setSpaceInInteractiveBannerStyle() {
  1052. $('.interactive-banner-style-02').each(function () {
  1053. let _this = $(this),
  1054. figure = _this.find('figure'),
  1055. figcaption = _this.find('figcaption');
  1056. setTimeout(function () {
  1057. figure.css({'padding-bottom': figcaption.outerHeight()});
  1058. }, 500);
  1059. });
  1060. }
  1061. /* ===================================
  1062. Video
  1063. ====================================== */
  1064. // Video player in background
  1065. $(document).on('click', '.html-video-play', function () {
  1066. var $videoBg = $(this).parents('section').find('.video-bg');
  1067. if ($(this).is('[playing]') === false) {
  1068. $videoBg.trigger('play');
  1069. $(this).attr('playing', 'true');
  1070. $(this).parents('section').find('.video-play-icon').addClass('remove-play-icon');
  1071. } else {
  1072. $videoBg.trigger('pause');
  1073. $(this).removeAttr('playing');
  1074. $(this).parents('section').find('.video-play-icon').removeClass('remove-play-icon');
  1075. }
  1076. });
  1077. // Fit video
  1078. if (typeof $.fn.fitVids === 'function') {
  1079. $('.fit-videos').fitVids();
  1080. }
  1081. /* ===================================
  1082. Countdown timer
  1083. ====================================== */
  1084. if ($.fn.countdown !== undefined && $.fn.countdown !== null) {
  1085. $('.countdown').each(function () {
  1086. var _this = $(this);
  1087. _this.countdown(_this.attr("data-enddate")).on('update.countdown', function (event) {
  1088. _this.html(event.strftime('' + '<div class="counter-container"><div class="countdown-box first"><div class="number">%-D</div><span>Days</span></div>' + '<div class="countdown-box"><div class="number">%H</div><span>Hours</span></div>' + '<div class="countdown-box"><div class="number">%M</div><span>Minutes</span></div>' + '<div class="countdown-box last"><div class="number">%S</div><span>Seconds</span></div></div>'));
  1089. }).on('finish.countdown', function (event) {
  1090. _this.html(event.strftime('' + '<div class="counter-container"><div class="countdown-box first" data-number="00"><div class="number">00</div><span>Days</span></div>' + '<div class="countdown-box"><div class="number">00</div><span>Hours</span></div>' + '<div class="countdown-box"><div class="number">00</div><span>Minutes</span></div>' + '<div class="countdown-box last"><div class="number">00</div><span>Seconds</span></div></div>'));
  1091. });
  1092. });
  1093. }
  1094. /* ===================================
  1095. Anime - animation library
  1096. ====================================== */
  1097. // Anime animation
  1098. function animeAnimation(target, options) {
  1099. let child = target;
  1100. let staggerValue = options.staggervalue || 0;
  1101. let delay = options.delay || 0;
  1102. let anime_animation = anime.createTimeline();
  1103. function applyTransitionStyles(elements) {
  1104. for (let i = 0; i < elements.length; i++) {
  1105. const element = elements[i];
  1106. element.style.opacity = 0;
  1107. element.style.transition = 'none';
  1108. element.style.transform = "none";
  1109. if (options.willchange) {
  1110. element.style.willChange = 'transform';
  1111. }
  1112. }
  1113. }
  1114. if (options.el === "childs") {
  1115. child = target.children;
  1116. applyTransitionStyles(target.children);
  1117. }
  1118. if (options.el === "lines") {
  1119. function lineSplitting() {
  1120. const lines = Splitting({target: target, by: 'lines'});
  1121. const line = lines[0].lines.map(item => item.map(i => i.innerHTML).join(" "));
  1122. target.innerHTML = line.map(item => `<span class="d-inline-flex">${item}</span>`).join(' ');
  1123. }
  1124. lineSplitting();
  1125. applyTransitionStyles(target.children);
  1126. child = target.children;
  1127. }
  1128. if (options.el === "words") {
  1129. function lineSplitting() {
  1130. const words = Splitting({target: target, by: 'words'});
  1131. const word = words[0].words.join(" ");
  1132. }
  1133. lineSplitting();
  1134. applyTransitionStyles(target.children);
  1135. child = target.children;
  1136. }
  1137. if (options.perspective) {
  1138. target.style.perspective = `${options.perspective}px`;
  1139. }
  1140. if (options.willchange) {
  1141. target.style.willChange = options.willchange;
  1142. }
  1143. anime_animation.add(child, {
  1144. ...options,
  1145. delay: anime.stagger(staggerValue, {start: delay}),
  1146. onComplete: function () {
  1147. if (options.el) {
  1148. target.classList.add('anime-child');
  1149. target.classList.add('anime-complete');
  1150. for (let i = 0; i < target.children.length; i++) {
  1151. const element = target.children[i];
  1152. element.style.removeProperty('opacity');
  1153. element.style.removeProperty('transform');
  1154. element.style.removeProperty('transition');
  1155. if (target.classList.contains('grid')) {
  1156. element.style.transition = 'none';
  1157. }
  1158. }
  1159. if (options.el === "lines") {
  1160. for (let i = 0; i < target.children.length; i++) {
  1161. const element = target.children[i];
  1162. element.classList.remove('d-inline-flex');
  1163. element.classList.add('d-inline');
  1164. element.style.willChange = "inherit";
  1165. }
  1166. }
  1167. } else {
  1168. target.classList.add('anime-complete');
  1169. target.style.removeProperty('opacity');
  1170. target.style.removeProperty('transform');
  1171. target.style.removeProperty('transition');
  1172. }
  1173. }
  1174. });
  1175. }
  1176. const $dataAnimeElements = $('[data-anime]:not(.swiper [data-anime])');
  1177. $dataAnimeElements.each(function () {
  1178. const $self = $(this);
  1179. const animeOptions = $self.data('anime');
  1180. // Access the delay value
  1181. const delayValue = animeOptions.delay;
  1182. if (animeOptions && getWindowWidth() > animeBreakPoint) {
  1183. try {
  1184. const effect = animeOptions.effect && animeOptions.effect.toLowerCase();
  1185. $self.on('appear', function () {
  1186. if ($self.hasClass('appear') || $self.hasClass('animating')) {
  1187. return;
  1188. }
  1189. $self.addClass('animating');
  1190. if (!$self.hasClass('appear')) {
  1191. setTimeout(function () {
  1192. $self.removeClass('animating').addClass('appear');
  1193. }, delayValue);
  1194. if (effect === 'slide') {
  1195. slideAnimation(this, animeOptions);
  1196. } else {
  1197. animeAnimation(this, animeOptions);
  1198. }
  1199. }
  1200. if ($self.hasClass('grid')) {
  1201. $self.find('.grid-sizer').removeAttr('style');
  1202. }
  1203. });
  1204. } catch (error) {
  1205. console.error('Error parsing anime options:', error);
  1206. }
  1207. } else {
  1208. $self.removeAttr('data-anime');
  1209. $("body").addClass("no-animation");
  1210. }
  1211. });
  1212. // Anime text revealer js
  1213. const slideAnimation = (target, options) => {
  1214. let duration = options.speed ? options.speed : 100,
  1215. direction = options.direction ? options.direction : "lr",
  1216. delay = options.delay ? options.delay : 0;
  1217. target.style.position = 'relative';
  1218. Array.from(target.children).forEach(child => {
  1219. child.style.opacity = 0;
  1220. });
  1221. // Create slide panel div
  1222. let tmp = document.createElement('div');
  1223. tmp.style.width = tmp.style.height = '100%';
  1224. tmp.style.top = tmp.style.left = 0;
  1225. tmp.style.background = options.color ? options.color : '#fff';
  1226. tmp.style.position = 'absolute';
  1227. if (direction === 'lr') {
  1228. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 50%';
  1229. tmp.style.WebkitTransform = tmp.style.transform = 'scaleX(0)';
  1230. } else if (direction === 'tb') {
  1231. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '50% 0%';
  1232. tmp.style.WebkitTransform = tmp.style.transform = 'scaleY(0)';
  1233. } else if (direction === 'bt') {
  1234. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 100%';
  1235. tmp.style.WebkitTransform = tmp.style.transform = 'scaleY(0)';
  1236. } else {
  1237. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 50%';
  1238. tmp.style.WebkitTransform = tmp.style.transform = 'scaleX(0)';
  1239. }
  1240. target.appendChild(tmp);
  1241. // init Anime js.
  1242. let slide_anime = anime.createTimeline();
  1243. slide_anime.add(tmp, {
  1244. scaleX: (direction === 'lr' || direction === 'rl') ? [0, 1] : [1, 1],
  1245. scaleY: (direction === 'tb' || direction === 'bt') ? [0, 1] : [1, 1],
  1246. duration: duration + 500,
  1247. ease: 'InOutCubic',
  1248. delay: delay,
  1249. onComplete: function () {
  1250. if (direction === 'lr') {
  1251. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 50%';
  1252. } else if (direction === 'tb') {
  1253. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '50% 100%';
  1254. } else if (direction === 'bt') {
  1255. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 0%';
  1256. } else {
  1257. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 50%';
  1258. }
  1259. animate(tmp, {
  1260. duration: duration + 500,
  1261. ease: 'InOutCubic',
  1262. scaleX: (direction === 'lr' || direction === 'rl') ? [1, 0] : [1, 1],
  1263. scaleY: (direction === 'tb' || direction === 'bt') ? [1, 0] : [1, 1],
  1264. onComplete: function () {
  1265. target.removeChild(tmp);
  1266. if (typeof callback === 'function') {
  1267. callback();
  1268. }
  1269. }
  1270. });
  1271. }
  1272. }).add(target.querySelector('*'), {
  1273. ease: 'OutQuint',
  1274. delay: direction === 'lr' ? anime.stagger(duration, {start: 1000}) : anime.stagger(-duration, {start: 1000}),
  1275. opacity: [0, 1]
  1276. }, "-=900");
  1277. }
  1278. /* ===================================
  1279. Fancy text animation
  1280. ====================================== */
  1281. // Curved text effect
  1282. const curvedTextAnimation = (target, options) => {
  1283. let duration = options.duration ? (options.duration <= 2000 ? 2000 : options.duration) : 2000,
  1284. content = options.string,
  1285. curveText = anime.createTimeline();
  1286. const lineEq = (y2, y1, x2, x1, currentVal) => {
  1287. var m = (y2 - y1) / (x2 - x1),
  1288. b = y1 - m * x1;
  1289. return m * currentVal + b;
  1290. }
  1291. const curveTextchar = target.querySelectorAll('.anime-text > .word > .char')
  1292. curveTextchar.forEach(curve => {
  1293. curve.style.opacity = 0;
  1294. curve.style.transform = 'none';
  1295. curve.style.willChange = 'transform';
  1296. });
  1297. curveText.add(curveTextchar, {
  1298. duration: 800,
  1299. ease: 'outElastic',
  1300. opacity: 1,
  1301. translateY: function (el, index) {
  1302. var p = el.parentNode,
  1303. lastElOffW = p.lastElementChild.offsetWidth,
  1304. firstElOffL = p.firstElementChild.offsetLeft,
  1305. w = p.offsetWidth - lastElOffW - firstElOffL - (p.offsetWidth - lastElOffW - p.lastElementChild.offsetLeft),
  1306. tyVal = lineEq(0, 100, firstElOffL + w / 2, firstElOffL, el.offsetLeft);
  1307. return [Math.abs(tyVal) + '%', '0%'];
  1308. },
  1309. rotateZ: function (el, index) {
  1310. var p = el.parentNode,
  1311. lastElOffW = p.lastElementChild.offsetWidth,
  1312. firstElOffL = p.firstElementChild.offsetLeft,
  1313. w = p.offsetWidth - lastElOffW - p.firstElementChild.offsetLeft - (p.offsetWidth - lastElOffW - p.lastElementChild.offsetLeft),
  1314. rz = lineEq(90, -90, firstElOffL + w, firstElOffL, el.offsetLeft);
  1315. return [rz, 0];
  1316. }
  1317. }).add(curveTextchar, {
  1318. duration: 1000,
  1319. ease: 'inExpo',
  1320. opacity: content.length > 1 ? 0 : 1,
  1321. translateY: function (el, index) {
  1322. var p = el.parentNode,
  1323. lastElOffW = p.lastElementChild.offsetWidth,
  1324. firstElOffL = p.firstElementChild.offsetLeft,
  1325. w = p.offsetWidth - lastElOffW - firstElOffL - (p.offsetWidth - lastElOffW - p.lastElementChild.offsetLeft),
  1326. tyVal = lineEq(0, 100, firstElOffL + w / 2, firstElOffL, el.offsetLeft);
  1327. return content.length > 1 ? ['0%', -Math.abs(tyVal) + '%'] : [Math.abs(tyVal) + '%', '0%'];
  1328. },
  1329. rotateZ: function (el, index) {
  1330. var p = el.parentNode,
  1331. lastElOffW = p.lastElementChild.offsetWidth,
  1332. firstElOffL = p.firstElementChild.offsetLeft,
  1333. w = p.offsetWidth - lastElOffW - p.firstElementChild.offsetLeft - (p.offsetWidth - lastElOffW - p.lastElementChild.offsetLeft),
  1334. rz = lineEq(-90, 90, firstElOffL + w, firstElOffL, el.offsetLeft);
  1335. return content.length > 1 ? [rz] : [rz, 0];
  1336. }
  1337. }, duration - 1500);
  1338. }
  1339. // Slide text effect
  1340. const slideTextAnimation = (target, options) => {
  1341. let current_anime_text = target.querySelectorAll('.anime-text')[0],
  1342. speed = options.speed ? options.speed : 100;
  1343. current_anime_text.style.position = 'relative';
  1344. // Create slide panel div
  1345. let tmp = document.createElement('div');
  1346. tmp.style.width = tmp.style.height = '100%';
  1347. tmp.style.top = tmp.style.left = 0;
  1348. tmp.style.background = options.color ? options.color : '#fff';
  1349. tmp.style.position = 'absolute';
  1350. tmp.style.WebkitTransform = tmp.style.transform = 'scaleX(0)';
  1351. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 50%';
  1352. if (options.direction === 'left') {
  1353. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 50%';
  1354. }
  1355. current_anime_text.appendChild(tmp);
  1356. target.querySelectorAll('.anime-text > .word > .char').forEach(char => {
  1357. char.style.opacity = 0;
  1358. char.style.transform = 'none';
  1359. });
  1360. // init Anime js.
  1361. let slide_anime = anime.createTimeline();
  1362. slide_anime.add(current_anime_text.querySelectorAll('div'), {
  1363. scaleX: [0, 1],
  1364. duration: speed + 500,
  1365. ease: 'inOutCubic',
  1366. onComplete: function () {
  1367. if (options.direction === 'left') {
  1368. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 50%';
  1369. } else {
  1370. tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 50%';
  1371. }
  1372. animate(tmp, {
  1373. duration: speed + 500,
  1374. ease: 'inOutCubic',
  1375. scaleX: [1, 0],
  1376. onComplete: function () {
  1377. current_anime_text.removeChild(tmp);
  1378. if (typeof callback === 'function') {
  1379. callback();
  1380. }
  1381. }
  1382. });
  1383. }
  1384. }).add(target.querySelectorAll('.anime-text > .word > .char'), {
  1385. ease: 'outQuint',
  1386. delay: options.direction === 'left' ? anime.stagger(speed, {start: 1000}) : anime.stagger(-speed, {start: 1000}),
  1387. opacity: [0, 1],
  1388. translateX: options.direction === 'left' ? [100, 0] : [-100, 0]
  1389. }, "-=600");
  1390. }
  1391. // Wave text effect
  1392. const waveTextAnimation = (target, options) => {
  1393. let duration = options.duration ? options.duration : 3000,
  1394. direction = options.direction,
  1395. content = options.string,
  1396. speed = options.speed,
  1397. waveText = anime.createTimeline();
  1398. const waveTextchar = target.querySelectorAll('.anime-text > .word > .char')
  1399. waveTextchar.forEach(wave => {
  1400. wave.style.opacity = 0;
  1401. wave.style.transform = 'none';
  1402. wave.style.willChange = 'transform';
  1403. });
  1404. waveText.add(waveTextchar, {
  1405. opacity: [0, 1],
  1406. translateY: direction === 'down' ? [-40, 0] : [40, 0],
  1407. duration: 600,
  1408. ease: 'outElastic(1, .7)',
  1409. delay: anime.stagger(speed ? speed : 50)
  1410. }).add(waveTextchar, {
  1411. opacity: content.length > 1 ? [1, 0] : [1, 1],
  1412. duration: 500,
  1413. ease: 'inBack',
  1414. translateY: content.length > 1 ? (direction === 'down' ? [0, 40] : [0, -40]) : [0, 0],
  1415. delay: anime.stagger(speed ? speed : 50, {start: duration - 1200})
  1416. });
  1417. }
  1418. // Smooth wave text effect
  1419. const smoothWaveTextAnimation = (target, options) => {
  1420. let duration = options.duration ? options.duration : 3000,
  1421. direction = options.direction,
  1422. content = options.string,
  1423. speed = options.speed,
  1424. smoothWaveText = anime.createTimeline();
  1425. const smoothWaveTextchar = target.querySelectorAll('.anime-text > .word > .char')
  1426. smoothWaveTextchar.forEach(smoothwave => {
  1427. smoothwave.style.opacity = 0;
  1428. smoothwave.style.transform = 'none';
  1429. smoothwave.style.willChange = 'transform';
  1430. });
  1431. smoothWaveText.add(smoothWaveTextchar, {
  1432. opacity: [0, 1],
  1433. translateY: direction === 'down' ? [-50, 0] : [50, 0],
  1434. duration: 500,
  1435. ease: 'outQuad',
  1436. delay: anime.stagger(speed ? speed : 40, {reversed: true}),
  1437. }).add(smoothWaveTextchar, {
  1438. opacity: content.length > 1 ? [1, 0] : [1, 1],
  1439. translateY: content.length > 1 ? (direction === 'down' ? 50 : -50) : 0,
  1440. duration: 500,
  1441. ease: 'outQuad',
  1442. delay: anime.stagger(speed ? speed : 40, {start: duration - 1000, reversed: true})
  1443. });
  1444. }
  1445. // Rotate text effect
  1446. const rotateTextAnimation = (target, options) => {
  1447. let duration = options.duration ? options.duration : 3000,
  1448. content = options.string,
  1449. speed = options.speed,
  1450. rotateText = anime.createTimeline();
  1451. const rotateTextchar = target.querySelectorAll('.anime-text > .word > .char')
  1452. rotateTextchar.forEach(rotate => {
  1453. rotate.style.opacity = 0;
  1454. rotate.style.transform = 'none';
  1455. rotate.style.willChange = 'transform';
  1456. });
  1457. rotateText.add(rotateTextchar, {
  1458. opacity: [0, 1],
  1459. rotateX: [-70, 0],
  1460. duration: 150,
  1461. delay: anime.stagger(speed ? speed : 50),
  1462. ease: "linear"
  1463. }).add(rotateTextchar, {
  1464. opacity: content.length > 1 ? 0 : 1,
  1465. rotateX: content.length > 1 ? [0, 70] : [0, 0],
  1466. duration: 150,
  1467. delay: anime.stagger(speed ? speed : 50, {start: duration - 1500}),
  1468. ease: "linear"
  1469. });
  1470. }
  1471. // Jump text effect
  1472. const jumpTextAnimation = (target, options) => {
  1473. let duration = options.duration ? options.duration : 3000,
  1474. content = options.string,
  1475. speed = options.speed,
  1476. delay = options.delay,
  1477. movingLetter9 = anime.createTimeline();
  1478. const jumpTextchar = target.querySelectorAll('.anime-text > .word > .char')
  1479. movingLetter9.add(jumpTextchar, {
  1480. scale: [0, 1],
  1481. duration: 1500,
  1482. ease: "outElastic(1, .5)",
  1483. transformOrigin: '50% 100%',
  1484. delay: anime.stagger(speed ? speed : 45, {start: delay})
  1485. }).add(jumpTextchar, {
  1486. opacity: content.length > 1 ? 0 : 1,
  1487. scale: content.length > 1 ? 0 : 1,
  1488. duration: 500,
  1489. ease: "outExpo",
  1490. delay: anime.stagger(speed ? speed : 45)
  1491. }, `+=${duration - 2300}`);
  1492. }
  1493. // Zoom text effect
  1494. const zoomTextAnimation = (target, options) => {
  1495. let duration = options.duration ? options.duration : 3000,
  1496. content = options.string,
  1497. speed = options.speed,
  1498. movingLetter2 = anime.createTimeline();
  1499. const zoomchars = target.querySelectorAll('.anime-text > .word > .char');
  1500. if (!zoomchars.length)
  1501. return;
  1502. zoomchars.forEach(zoom => {
  1503. zoom.style.opacity = 0;
  1504. zoom.style.transform = 'none';
  1505. zoom.style.willChange = 'transform';
  1506. });
  1507. movingLetter2.add(zoomchars, {
  1508. scale: [4, 1],
  1509. opacity: [0, 1],
  1510. translateZ: 0,
  1511. ease: "outExpo",
  1512. duration: 950,
  1513. delay: anime.stagger(speed ? speed : 70)
  1514. }).add(target.querySelectorAll('.anime-text > .word'), {
  1515. opacity: content.length > 1 ? 0 : 1,
  1516. duration: 1000,
  1517. ease: "outExpo",
  1518. delay: 1000
  1519. }, `+=${duration - 2500}`);
  1520. }
  1521. // Rubber band text effect
  1522. const rubberbandTextAnimation = (target, options) => {
  1523. let duration = options.duration || 3000,
  1524. content = options.string,
  1525. speed = options.speed || 75,
  1526. direction = options.direction,
  1527. rubberband = anime.createTimeline();
  1528. const rubberbandchars = target.querySelectorAll('.anime-text > .word > .char');
  1529. if (!rubberbandchars.length)
  1530. return;
  1531. rubberbandchars.forEach(rubberBand => {
  1532. rubberBand.style.opacity = 0;
  1533. rubberBand.style.transform = 'none';
  1534. rubberBand.style.willChange = 'transform';
  1535. });
  1536. rubberband.add(rubberbandchars, {
  1537. translateX: direction === "right" ? [-40, 0] : [40, 0],
  1538. translateZ: 0,
  1539. opacity: [0, 1],
  1540. ease: "outExpo",
  1541. duration: 1200,
  1542. delay: anime.stagger(speed, {direction: direction === "right" ? 'reverse' : 'normal'})
  1543. })
  1544. .add(rubberbandchars, {
  1545. translateX: content.length > 1 ? (direction === "left" ? -40 : 40) : 0,
  1546. opacity: content.length > 1 ? 0 : 1,
  1547. ease: "inExpo",
  1548. duration: 500,
  1549. delay: anime.stagger(speed, {start: duration - 2500, direction: direction === "right" ? 'reverse' : 'normal'})
  1550. });
  1551. };
  1552. // Fade text effect
  1553. const fadeTextAnimation = (target, options) => {
  1554. let duration = options.duration ? options.duration : 3000,
  1555. content = options.string,
  1556. speed = options.speed,
  1557. fade = anime.createTimeline();
  1558. const fadeTextchar = target.querySelectorAll('.anime-text > .word > .char')
  1559. fadeTextchar.forEach(fadeeffect => {
  1560. fadeeffect.style.opacity = 0;
  1561. fadeeffect.style.transform = 'none';
  1562. fadeeffect.style.willChange = 'transform';
  1563. });
  1564. fade.add(fadeTextchar, {
  1565. translateY: [100, 0],
  1566. translateZ: 0,
  1567. opacity: [0, 1],
  1568. ease: "outExpo",
  1569. delay: anime.stagger(speed ? speed : 30)
  1570. }).add(fadeTextchar, {
  1571. translateY: content.length > 1 ? [0, -100] : [0, 0],
  1572. opacity: content.length > 1 ? [1, 0] : [1, 1],
  1573. ease: "inExpo",
  1574. delay: anime.stagger(speed ? speed : 40, {start: duration - 3000})
  1575. });
  1576. }
  1577. // Fancy text
  1578. function FancyTextDefault(item, ftOptions) {
  1579. let text_effect = ftOptions.effect,
  1580. duration = ftOptions.duration ? ftOptions.duration : 3000,
  1581. content = ftOptions.string,
  1582. speed = ftOptions.speed,
  1583. delay = ftOptions.delay;
  1584. if (content) {
  1585. item.innerHTML = `<span class="anime-text">${content[0]}</span>`;
  1586. item.querySelector('.anime-text').setAttribute('data-splitting', true);
  1587. Splitting();
  1588. if (getWindowWidth() > animeBreakPoint) {
  1589. switch (text_effect) {
  1590. case 'wave':
  1591. waveTextAnimation(item, ftOptions);
  1592. break;
  1593. case 'smooth-wave':
  1594. smoothWaveTextAnimation(item, ftOptions);
  1595. break;
  1596. case 'curve':
  1597. curvedTextAnimation(item, ftOptions);
  1598. break;
  1599. case 'rotate':
  1600. rotateTextAnimation(item, ftOptions);
  1601. break;
  1602. case 'slide':
  1603. slideTextAnimation(item, ftOptions);
  1604. break;
  1605. case 'jump':
  1606. jumpTextAnimation(item, ftOptions);
  1607. break;
  1608. case 'zoom':
  1609. zoomTextAnimation(item, ftOptions);
  1610. break;
  1611. case 'rubber-band':
  1612. rubberbandTextAnimation(item, ftOptions);
  1613. break;
  1614. case 'fade':
  1615. fadeTextAnimation(item, ftOptions);
  1616. break;
  1617. default:
  1618. }
  1619. if (text_effect === undefined) {
  1620. animate(item.querySelectorAll('.anime-text > .word > .char'), {
  1621. ...ftOptions,
  1622. delay: anime.stagger(speed ? speed : 0, {start: delay ? delay : 0})
  1623. })
  1624. }
  1625. }
  1626. if (content.length > 1) {
  1627. let counter = 1;
  1628. setInterval(function () {
  1629. let new_el = document.createElement('span');
  1630. new_el.classList.add('anime-text');
  1631. new_el.innerHTML = content[counter];
  1632. new_el.setAttribute('data-splitting', true);
  1633. item.querySelector('.anime-text').replaceWith(new_el);
  1634. Splitting();
  1635. counter++;
  1636. if (counter === content.length) {
  1637. counter = 0;
  1638. }
  1639. switch (text_effect) {
  1640. case 'wave':
  1641. waveTextAnimation(item, ftOptions);
  1642. break;
  1643. case 'smooth-wave':
  1644. smoothWaveTextAnimation(item, ftOptions);
  1645. break;
  1646. case 'curve':
  1647. curvedTextAnimation(item, ftOptions);
  1648. break;
  1649. case 'rotate':
  1650. rotateTextAnimation(item, ftOptions);
  1651. break;
  1652. case 'slide':
  1653. slideTextAnimation(item, ftOptions);
  1654. break;
  1655. case 'jump':
  1656. jumpTextAnimation(item, ftOptions);
  1657. break;
  1658. case 'zoom':
  1659. zoomTextAnimation(item, ftOptions);
  1660. break;
  1661. case 'rubber-band':
  1662. rubberbandTextAnimation(item, ftOptions);
  1663. break;
  1664. case 'fade':
  1665. fadeTextAnimation(item, ftOptions);
  1666. break;
  1667. default:
  1668. }
  1669. if (text_effect === undefined) {
  1670. animate(item.querySelectorAll('.anime-text > .word > .char'), {
  1671. ...ftOptions,
  1672. delay: anime.stagger(speed ? speed : 0, {start: delay ? delay : 0})
  1673. });
  1674. }
  1675. }, duration);
  1676. }
  1677. }
  1678. }
  1679. $('[data-fancy-text]').each(function () {
  1680. const _this = $(this);
  1681. const ftOptions = _this.data('fancy-text');
  1682. if (ftOptions) {
  1683. if (_this.hasClass('swiper-parallax-fancy-text')) {
  1684. FancyTextDefault(this, ftOptions);
  1685. } else {
  1686. _this.on('appear', function () {
  1687. if (!_this.hasClass('appear')) {
  1688. _this.addClass('appear');
  1689. FancyTextDefault(this, ftOptions);
  1690. }
  1691. });
  1692. }
  1693. }
  1694. });
  1695. if ($('html').attr('dir') === 'rtl') {
  1696. $('[data-fancy-text]').each(function () {
  1697. if ($(this).parents('.fancy-text-style-4').length) {
  1698. $(this).parents('.fancy-text-style-4').css({
  1699. direction: 'ltr',
  1700. });
  1701. } else {
  1702. $(this).css({
  1703. direction: 'ltr',
  1704. });
  1705. }
  1706. });
  1707. }
  1708. /* ===================================
  1709. Instagram feed
  1710. ====================================== */
  1711. var instagramWrapperItems = document.querySelectorAll('.instafeed-wrapper');
  1712. instagramWrapperItems.forEach(function (instagramWrapperItem) {
  1713. var token = 'IGQWROLXF6d1l6anM0WU81SkhHdDFsSkZAUNS1xTHdPSm1naXR3UkQzd01jczR6X1Q4cGdsdTVVMjRUX3NNc0RMOTRZAbVdQSjdpMUZAxYjNpc1puc18ycDI1eUZAoaUlxSm5TbW0tOExiUDVpMm12T0hLai10MUxqanMZD',
  1714. _this = $(instagramWrapperItem),
  1715. token = _this.attr('data-token') || token,
  1716. total = _this.attr('data-total') || '6', // how much photos do you want to get
  1717. slider = _this.attr('data-slider-options'),
  1718. _html = _this.html(),
  1719. outputHTML = '';
  1720. if (typeof (slider) !== 'undefined' && slider !== null) {
  1721. _this.html('');
  1722. }
  1723. $.ajax({
  1724. url: 'https://graph.instagram.com/me/media?fields=id,media_type,media_url,timestamp,permalink&access_token=' + token,
  1725. type: 'GET',
  1726. success: function (response) {
  1727. outputHTML += _this.find('.grid-item').length ? '<li class="grid-sizer"></li>' : '';
  1728. for (var x in response.data) {
  1729. if (x < parseInt(total)) {
  1730. if (response.data[x]['media_type'] == 'IMAGE' || response.data[x]['media_type'] == 'CAROUSEL_ALBUM') {
  1731. console.log('image');
  1732. var link = response.data[x]['permalink'] || '',
  1733. image = response.data[x]['media_url'] || '',
  1734. likes = response.data[x]['like_count'] || '',
  1735. comments = response.data[x]['comments_count'] || '',
  1736. output = _html;
  1737. output = output.replace(' href="#"', '');
  1738. output = output.replace(' src="#"', '');
  1739. output = output.replace('data-href', 'href');
  1740. output = output.replace('data-src', 'src');
  1741. output = output.replace('{{link}}', link);
  1742. output = output.replace('{{image}}', image);
  1743. output = output.replace('{{likes}}', likes);
  1744. output = output.replace('{{comments}}', comments);
  1745. output = output.replace('{{image-class}}', 'image');
  1746. outputHTML += output;
  1747. } else if (response.data[x]['media_type'] == 'VIDEO') {
  1748. var link = response.data[x]['permalink'] || '',
  1749. video = response.data[x]['media_url'] || '';
  1750. output = output.replace('{{video}}', video);
  1751. output = output.replace('{{video-class}}', 'video');
  1752. outputHTML += output;
  1753. }
  1754. }
  1755. }
  1756. _this.html(outputHTML);
  1757. if (typeof (slider) !== 'undefined' && slider !== null) {
  1758. // Apply swiper
  1759. var sliderOptions = $.parseJSON(slider);
  1760. var swiperObj = instagramWrapperItem.parentElement;
  1761. if (typeof Swiper === 'function') {
  1762. new Swiper(swiperObj, sliderOptions);
  1763. }
  1764. } else {
  1765. // Apply isotope
  1766. _this.imagesLoaded(function () {
  1767. _this.removeClass('grid-loading');
  1768. if (typeof $.fn.isotope === 'function') {
  1769. _this.isotope({
  1770. layoutMode: 'masonry',
  1771. itemSelector: '.grid-item',
  1772. percentPosition: true,
  1773. stagger: 0,
  1774. masonry: {
  1775. columnWidth: '.grid-sizer',
  1776. }
  1777. });
  1778. }
  1779. isotopeObjs.push(_this);
  1780. });
  1781. }
  1782. },
  1783. error: function (data) {
  1784. var output = '<div class="col-12"><span class=text-center>No Images Found</span></div>';
  1785. _this.append(output);
  1786. }
  1787. });
  1788. });
  1789. /* ===================================
  1790. Subscribe popup on page load
  1791. ====================================== */
  1792. if (typeof $.fn.magnificPopup === 'function') {
  1793. if ($('#subscribe-popup').length > 0) {
  1794. let delaySecond = 1.5,
  1795. expireDays = 30,
  1796. cookieName = 'crafto-promo-popup';
  1797. if (getCookie(cookieName) != 'shown') {
  1798. setTimeout(function () {
  1799. $.magnificPopup.open({
  1800. showCloseBtn: false,
  1801. items: {
  1802. src: '#subscribe-popup'
  1803. },
  1804. type: 'inline',
  1805. mainClass: 'my-mfp-zoom-in',
  1806. callbacks: {
  1807. close: function () {
  1808. if ($('#newsletter-off').is(':checked')) {
  1809. setCookie(cookieName, 'shown', expireDays);
  1810. }
  1811. }
  1812. }
  1813. });
  1814. }, (delaySecond * 3500));
  1815. }
  1816. }
  1817. }
  1818. /* ===================================
  1819. Magnific popup
  1820. ====================================== */
  1821. if (typeof $.fn.magnificPopup === 'function') {
  1822. // Modal popup
  1823. $('.modal-popup').magnificPopup({
  1824. type: 'inline',
  1825. preloader: false,
  1826. blackbg: true
  1827. });
  1828. // Modal popup close
  1829. $(document).on('click', '.popup-modal-dismiss', function (e) {
  1830. e.preventDefault();
  1831. $.magnificPopup.close();
  1832. });
  1833. // Modal popup - zoom animation
  1834. $('.popup-with-zoom-anim').magnificPopup({
  1835. type: 'inline',
  1836. fixedContentPos: false,
  1837. fixedBgPos: true,
  1838. overflowY: 'auto',
  1839. closeBtnInside: true,
  1840. preloader: false,
  1841. midClick: true,
  1842. removalDelay: 300,
  1843. blackbg: true,
  1844. mainClass: 'my-mfp-zoom-in'
  1845. });
  1846. // Modal popup - move animation
  1847. $('.popup-with-move-anim').magnificPopup({
  1848. type: 'inline',
  1849. fixedContentPos: false,
  1850. fixedBgPos: true,
  1851. overflowY: 'auto',
  1852. closeBtnInside: true,
  1853. preloader: false,
  1854. midClick: true,
  1855. removalDelay: 300,
  1856. blackbg: true,
  1857. mainClass: 'my-mfp-slide-bottom'
  1858. });
  1859. // Modal popup - slide up animation
  1860. $('.slide-up-animation').magnificPopup({
  1861. type: 'inline',
  1862. fixedContentPos: false,
  1863. fixedBgPos: true,
  1864. overflowY: 'auto',
  1865. closeBtnInside: true,
  1866. preloader: false,
  1867. midClick: true,
  1868. removalDelay: 300,
  1869. blackbg: true,
  1870. mainClass: 'my-mfp-slide-up'
  1871. });
  1872. // Popup with form
  1873. $('.popup-with-form').magnificPopup({
  1874. type: 'inline',
  1875. preloader: false,
  1876. fixedContentPos: true,
  1877. focus: '#name',
  1878. callbacks: {
  1879. beforeOpen: function () {
  1880. if ($(window).width() < 700) {
  1881. this.st.focus = false;
  1882. } else {
  1883. this.st.focus = '#name';
  1884. }
  1885. }
  1886. }
  1887. });
  1888. // Video magnific popup
  1889. $('.popup-youtube, .popup-vimeo, .popup-googlemap').magnificPopup({
  1890. disableOn: 320,
  1891. type: 'iframe',
  1892. mainClass: 'mfp-fade',
  1893. removalDelay: 160,
  1894. preloader: false,
  1895. fixedContentPos: true,
  1896. closeBtnInside: false
  1897. });
  1898. // Ajax magnific popup
  1899. $('.ajax-popup').magnificPopup({
  1900. type: 'ajax',
  1901. alignTop: true,
  1902. fixedContentPos: true,
  1903. closeBtnInside: false,
  1904. overflowY: 'scroll', // as we know that popup content is tall we set scroll overflow by default to avoid jump
  1905. callbacks: {
  1906. open: function () {
  1907. $('.navbar .collapse').removeClass('show');
  1908. $('.navbar a.dropdown-toggle').addClass('collapsed');
  1909. }
  1910. }
  1911. });
  1912. }
  1913. /* ===================================
  1914. Contact form validation
  1915. ====================================== */
  1916. // Contact form validation on submit
  1917. $(document).on('click', '.submit', function () {
  1918. var error = false,
  1919. _this = $(this),
  1920. formObj = _this.parents('form'),
  1921. emailFormat = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
  1922. urlformat = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,
  1923. telFormat = /[0-9 -()+]+$/,
  1924. actionURL = formObj.attr('action'),
  1925. resultsObj = formObj.find('.form-results'),
  1926. grecaptchav3 = _this.attr('data-sitekey') || '',
  1927. redirectVal = formObj.find('[name="redirect"]').val();
  1928. formObj.find('.required').removeClass('is-invalid');
  1929. formObj.find('.required').each(function () {
  1930. var __this = $(this),
  1931. fieldVal = __this.val();
  1932. if (fieldVal == '' || fieldVal == undefined) {
  1933. error = true;
  1934. __this.addClass('is-invalid');
  1935. } else if (__this.attr('type') == 'email' && !emailFormat.test(fieldVal)) {
  1936. error = true;
  1937. __this.addClass('is-invalid');
  1938. } else if (__this.attr('type') == 'url' && !urlformat.test(fieldVal)) {
  1939. error = true;
  1940. __this.addClass('is-invalid');
  1941. } else if (__this.attr('type') == 'tel' && !telFormat.test(fieldVal)) {
  1942. error = true;
  1943. __this.addClass('is-invalid');
  1944. }
  1945. });
  1946. var termsObj = formObj.find('.terms-condition');
  1947. if (termsObj.length) {
  1948. if (!termsObj.is(':checked')) {
  1949. error = true;
  1950. termsObj.addClass('is-invalid');
  1951. }
  1952. }
  1953. // Google reCaptcha verify
  1954. if (typeof (grecaptcha) !== 'undefined' && grecaptcha !== null) {
  1955. if (formObj.find('.g-recaptcha').length) {
  1956. var gResponse = grecaptcha.getResponse();
  1957. if (!(gResponse.length)) {
  1958. error = true;
  1959. formObj.find('.g-recaptcha').addClass('is-invalid');
  1960. }
  1961. } else if (grecaptchav3 != '' && grecaptchav3 != undefined) { // For Version 3
  1962. grecaptcha.ready(function () {
  1963. grecaptcha.execute(grecaptchav3, {action: 'submit'}).then(function (token) {
  1964. });
  1965. });
  1966. }
  1967. }
  1968. if (!error && actionURL != '' && actionURL != undefined) {
  1969. _this.addClass('loading');
  1970. $.ajax({
  1971. type: 'POST',
  1972. url: actionURL,
  1973. data: formObj.serialize(),
  1974. success: function (result) {
  1975. _this.removeClass('loading');
  1976. if (redirectVal != '' && redirectVal != undefined) {
  1977. window.location.href = redirectVal;
  1978. } else {
  1979. if (typeof (result) !== 'undefined' && result !== null) {
  1980. result = $.parseJSON(result);
  1981. }
  1982. formObj.find('input[type=text],input[type=url],input[type=email],input[type=tel],input[type=password],textarea').each(function () {
  1983. $(this).val('');
  1984. $(this).removeClass('is-invalid');
  1985. });
  1986. formObj.find('.g-recaptcha').removeClass('is-invalid');
  1987. formObj.find('input[type=checkbox],input[type=radio]').prop('checked', false);
  1988. if (formObj.find('.g-recaptcha').length) {
  1989. grecaptcha.reset();
  1990. }
  1991. resultsObj.removeClass('alert-success').removeClass('alert-danger').hide();
  1992. resultsObj.addClass(result.alert).html(result.message);
  1993. resultsObj.removeClass('d-none').fadeIn('slow').delay(4000).fadeOut('slow');
  1994. }
  1995. }
  1996. });
  1997. }
  1998. return false;
  1999. });
  2000. // Contact form validation on blur
  2001. $(document).on('blur', '.required', function () {
  2002. var emailFormat = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
  2003. telFormat = /[0-9 -()+]+$/,
  2004. urlformat = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,
  2005. fieldVal = $(this).val();
  2006. if (fieldVal == '' || fieldVal == undefined) {
  2007. $(this).addClass('is-invalid');
  2008. } else if ($(this).attr('type') == 'email' && !emailFormat.test(fieldVal)) {
  2009. $(this).addClass('is-invalid');
  2010. } else if ($(this).attr('type') == 'url' && !urlformat.test(fieldVal)) {
  2011. $(this).addClass('is-invalid');
  2012. } else if ($(this).attr('type') == 'tel' && !telFormat.test(fieldVal)) {
  2013. $(this).addClass('is-invalid');
  2014. } else {
  2015. $(this).removeClass('is-invalid').addClass('is-valid');
  2016. }
  2017. });
  2018. // Validate terms and conditions in form
  2019. $(document).on('click', '.terms-condition', function () {
  2020. var termsObj = $(this);
  2021. if (!termsObj.is(':checked')) {
  2022. termsObj.addClass('is-invalid');
  2023. } else {
  2024. termsObj.removeClass('is-invalid').addClass('is-valid');
  2025. }
  2026. });
  2027. /* ===================================
  2028. Revolution slider
  2029. ====================================== */
  2030. // Reinit skroller after revolution slider loaded
  2031. if ($('.rev_slider').length) {
  2032. $('.rev_slider').each(function () {
  2033. $(this).one('revolution.slide.onloaded', function () {
  2034. reInitSkrollr();
  2035. });
  2036. });
  2037. }
  2038. /* ===================================
  2039. Window on load
  2040. ====================================== */
  2041. $(window).on('load', function () {
  2042. // Bootstrap tooltip
  2043. var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
  2044. var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  2045. return new bootstrap.Tooltip(tooltipTriggerEl);
  2046. });
  2047. // Parallax
  2048. if (typeof $.fn.parallax !== 'undefined' && typeof $.fn.parallax !== null) {
  2049. setParallax();
  2050. }
  2051. // Non retina image code
  2052. $("img:not([data-at2x])").each(function () {
  2053. $(this).attr('data-no-retina', '');
  2054. });
  2055. // Page loader
  2056. if ($('.page-loader').length) {
  2057. $('.page-loader').fadeOut();
  2058. }
  2059. // Reset isotope loop
  2060. resetIsotopeLayoutLoop(isotopeObjs, false);
  2061. // Top overlap section position
  2062. setOverLayerPosition();
  2063. // Bottom overlap section position
  2064. setBottomOverLayerPosition();
  2065. // Set full screen height & top space
  2066. setTimeout(function () {
  2067. fullScreenHeight();
  2068. setTopSpaceHeight();
  2069. }, headerTransition); // Header transition effect time
  2070. });
  2071. /* ===================================
  2072. Page loader
  2073. ====================================== */
  2074. $(window).on("load", function () {
  2075. $('.page-loader').show();
  2076. setTimeout(function () {
  2077. $('.page-loader').hide();
  2078. }, 1000);
  2079. });
  2080. /* ===================================
  2081. Window resize
  2082. ====================================== */
  2083. $(window).resize(function () {
  2084. slideboxstyle();
  2085. setParallax();
  2086. initScrollNavigate();
  2087. setOverLayerPosition();
  2088. setBottomOverLayerPosition(100);
  2089. setSpaceInInteractiveBannerStyle();
  2090. // Update custom scrollbar for full screen & modern menu
  2091. if ($('.navbar-collapse-clone').length && typeof $.fn.mCustomScrollbar === 'function') {
  2092. $('.navbar-collapse-clone').mCustomScrollbar('update');
  2093. }
  2094. // Reset isotope
  2095. if (!isMobile) {
  2096. setTimeout(function () {
  2097. resetIsotopeLayoutLoop(isotopeObjs, true);
  2098. }, 300);
  2099. }
  2100. if ($(window).width() <= 1199) {
  2101. destroyAtropos();
  2102. destroySkrollr();
  2103. } else {
  2104. if (typeof Atropos !== 'undefined' && typeof Atropos !== null) {
  2105. initAtropos();
  2106. }
  2107. initSkrollr();
  2108. }
  2109. });
  2110. /* ===================================
  2111. Window orientation change
  2112. ====================================== */
  2113. $(window).on('orientationchange', function (e) {
  2114. // Top overlap section position
  2115. setOverLayerPosition();
  2116. // Bottom overlap section position
  2117. setBottomOverLayerPosition();
  2118. // Set full screen height & top space
  2119. setTimeout(function () {
  2120. fullScreenHeight();
  2121. setTopSpaceHeight();
  2122. }, headerTransition); // Header transition effect time
  2123. // Close all menu
  2124. $('.navbar-collapse.collapse').collapse('hide');
  2125. // Close push menu
  2126. $('html, body').removeClass('show-menu');
  2127. // Close search
  2128. $('body').removeClass('show-search-popup');
  2129. // Header color remove
  2130. $('header nav').removeClass('submenu-light').removeClass('submenu-dark');
  2131. // Close all dropdown menu
  2132. $('.dropdown').trigger('mouseleave');
  2133. // Close left submenu
  2134. $('.sub-menu.show').collapse('hide');
  2135. // Close left simple menu
  2136. $('.left-sidebar-header').collapse('hide');
  2137. stickyKitRecalc();
  2138. // Close left modern menu
  2139. $('.left-modern-header').collapse('hide');
  2140. });
  2141. /* ===================================
  2142. Window scroll
  2143. ====================================== */
  2144. $(window).on('scroll', initScrollNavigate);
  2145. // Window scroll Function
  2146. function initScrollNavigate() {
  2147. var scrollPos = $(window).scrollTop();
  2148. // One page navigation
  2149. var menuLinks = $('.navbar-nav li a');
  2150. menuLinks.each(function () {
  2151. var _this = $(this);
  2152. var hasPos = _this.attr('href').indexOf('#');
  2153. if (hasPos > -1) {
  2154. var res = _this.attr('href').substring(hasPos);
  2155. if (res != '' && res != '#' && $(res).length) {
  2156. var refElement = $(res);
  2157. if (refElement.position().top <= (scrollPos + 60) && refElement.position().top + refElement.height() > (scrollPos + 60)) {
  2158. menuLinks.removeClass('active');
  2159. _this.addClass('active');
  2160. }
  2161. if (scrollPos < 1) {
  2162. _this.removeClass('active');
  2163. }
  2164. }
  2165. }
  2166. });
  2167. // Sticky nav Start
  2168. var navHeight = 0,
  2169. miniHeaderHeight = 0;
  2170. if ($('header nav.navbar').length) {
  2171. navHeight = $('header nav.navbar').outerHeight();
  2172. }
  2173. if ($('.header-top-bar').length) {
  2174. miniHeaderHeight = $('.header-top-bar').outerHeight();
  2175. }
  2176. var headerHeight = navHeight + miniHeaderHeight;
  2177. if (!$('header').hasClass('no-sticky')) {
  2178. if (scrollPos >= headerHeight) {
  2179. $('header').addClass('sticky');
  2180. if (!$('.header-top-bar').is(':hidden')) {
  2181. $('.header-top-bar').css({'top': '-' + (miniHeaderHeight) + 'px'});
  2182. $('.header-top-bar + .navbar').css({'top': '0px'});
  2183. } else {
  2184. $('.header-top-bar, .header-top-bar + .navbar').css({'top': ''});
  2185. }
  2186. } else if (scrollPos <= headerHeight) {
  2187. $('header').removeClass('sticky');
  2188. if (!$('.header-top-bar').is(':hidden')) {
  2189. $('.header-top-bar').css({'top': '0px'});
  2190. $('.header-top-bar + .navbar').css({'top': (miniHeaderHeight) + 'px'});
  2191. } else {
  2192. $('.header-top-bar, .header-top-bar + .navbar').css({'top': ''});
  2193. }
  2194. }
  2195. }
  2196. // Header sticky
  2197. if (scrollPos > (headerHeight + 150)) {
  2198. setTimeout(function () {
  2199. $('header').addClass('sticky-active');
  2200. }, headerTransition); // Header transition effect time
  2201. }
  2202. if (scrollPos < headerHeight) {
  2203. setTimeout(function () {
  2204. $('header').removeClass('sticky-active');
  2205. }, headerTransition); // Header transition effect time
  2206. }
  2207. // Hide side menu on scroll
  2208. if (scrollPos >= 200 && getWindowWidth() > menuBreakPoint) {
  2209. // Close all dropdown menu
  2210. $('.dropdown').trigger('mouseleave');
  2211. }
  2212. // Scroll to top
  2213. if (scrollPos > 150) {
  2214. $('.scroll-top-arrow').fadeIn('300');
  2215. } else {
  2216. $('.scroll-top-arrow').fadeOut('300');
  2217. }
  2218. if ($('nav.header-reverse-back-scroll').length > 0) {
  2219. var st = scrollPos;
  2220. if (st > lastScroll) {
  2221. st = st - 1;
  2222. $('header').removeClass('sticky-appear');
  2223. } else {
  2224. $('header').addClass('sticky-appear');
  2225. }
  2226. lastScroll = st;
  2227. if (lastScroll <= headerHeight) {
  2228. $('header').removeClass('sticky-appear');
  2229. }
  2230. }
  2231. // Set full screen height & top space
  2232. if (scrollPos <= 0) {
  2233. setTimeout(function () {
  2234. fullScreenHeight();
  2235. setTopSpaceHeight();
  2236. }, headerTransition); // Header transition effect time
  2237. }
  2238. lastScroll = scrollPos;
  2239. }
  2240. /* ===================================
  2241. Utility functions start
  2242. ====================================== */
  2243. // Check formatted number
  2244. function pad(d) {
  2245. return (d < 10) ? '0' + d.toString() : d.toString();
  2246. }
  2247. // Check IE browser
  2248. function isIE() {
  2249. var ua = window.navigator.userAgent,
  2250. msie = ua.indexOf('MSIE ');
  2251. if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
  2252. return true;
  2253. } else {
  2254. return false;
  2255. }
  2256. return false;
  2257. }
  2258. // Get window height
  2259. function getWindowHeight() {
  2260. return $(window).height();
  2261. }
  2262. // Get window width
  2263. function getWindowWidth() {
  2264. return $(window).width();
  2265. }
  2266. // Full screen
  2267. function fullScreenHeight() {
  2268. var fullScreenObj = $('.full-screen'),
  2269. minHeight = getWindowHeight(),
  2270. headerHeight = getHeaderHeight();
  2271. if (!$('header').hasClass('sticky')) {
  2272. fullScreenObj.parents('section').imagesLoaded(function () {
  2273. if ($('section:first.full-screen, section:first .full-screen').length && ($('.top-space-margin').length || $('.mobile-top-space').length) || $('.ipad-top-space-margin').length) {
  2274. if ($('.ipad-top-space-margin').length) {
  2275. if (getWindowWidth() <= menuBreakPoint) {
  2276. $('section:first.full-screen, section:first .full-screen').css('height', minHeight - headerHeight);
  2277. } else {
  2278. $('section:first.full-screen, section:first .full-screen').css('height', minHeight);
  2279. }
  2280. } else {
  2281. $('section:first.full-screen, section:first .full-screen').css('height', minHeight - headerHeight);
  2282. }
  2283. } else if ($('header nav.navbar').hasClass('top-space-margin') || $('header nav.navbar').hasClass('mobile-top-space')) {
  2284. if ($('header nav.navbar').hasClass('ipad-top-space-margin')) {
  2285. if (getWindowWidth() <= menuBreakPoint) {
  2286. minHeight = minHeight - $('header nav.navbar').outerHeight();
  2287. }
  2288. } else {
  2289. minHeight = minHeight - $('header nav.navbar').outerHeight();
  2290. }
  2291. fullScreenObj.css('height', minHeight);
  2292. } else {
  2293. fullScreenObj.css('height', minHeight);
  2294. }
  2295. });
  2296. }
  2297. }
  2298. // Get cookie
  2299. function getCookie(cname) {
  2300. var name = cname + "=";
  2301. var decodedCookie = decodeURIComponent(document.cookie);
  2302. var ca = decodedCookie.split(';');
  2303. for (var i = 0; i < ca.length; i++) {
  2304. var c = ca[i];
  2305. while (c.charAt(0) == ' ') {
  2306. c = c.substring(1);
  2307. }
  2308. if (c.indexOf(name) == 0) {
  2309. return c.substring(name.length, c.length);
  2310. }
  2311. }
  2312. return "";
  2313. }
  2314. // Set cookie
  2315. function setCookie(cname, cvalue, exdays) {
  2316. var d = new Date();
  2317. d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  2318. var expires = (exdays != 0 && exdays != '') ? d.toUTCString() : 0;
  2319. document.cookie = cname + "=" + cvalue + ";expires=" + expires + ";path=/";
  2320. }
  2321. /* ===================================
  2322. Swiper slider
  2323. ====================================== */
  2324. // Setup swiper slider
  2325. function setupSwiper() {
  2326. // Swiper slider using params
  2327. var swipers = document.querySelectorAll('[data-slider-options]:not(.instafeed-wrapper)');
  2328. swipers.forEach(function (swiperItem) {
  2329. var _this = $(swiperItem),
  2330. sliderOptions = _this.attr('data-slider-options');
  2331. if (typeof (sliderOptions) !== 'undefined' && sliderOptions !== null) {
  2332. sliderOptions = $.parseJSON(sliderOptions);
  2333. // If user have provided "data-slide-change-on-click" attribute then below code will execute
  2334. var changeOnClick = _this.attr('data-slide-change-on-click');
  2335. if (changeOnClick != '' && changeOnClick != undefined && changeOnClick == '1') {
  2336. sliderOptions['on'] = {
  2337. click: function () {
  2338. if (this.activeIndex > this.clickedIndex) {
  2339. this.slidePrev();
  2340. } else if (this.activeIndex < this.clickedIndex) {
  2341. this.slideNext();
  2342. }
  2343. }
  2344. };
  2345. }
  2346. /* If user have provided "data-thumb-slider-md-direction" attribute then below code will execute */
  2347. if (sliderOptions['thumbs'] != '' && sliderOptions['thumbs'] != undefined) {
  2348. var mdThumbDirection = _this.attr('data-thumb-slider-md-direction');
  2349. if (mdThumbDirection != '' && mdThumbDirection != undefined) {
  2350. var thumbDirection = (sliderOptions['thumbs']['swiper']['direction'] != '' && sliderOptions['thumbs']['swiper']['direction'] != undefined) ? sliderOptions['thumbs']['swiper']['direction'] : mdThumbDirection;
  2351. sliderOptions['thumbs']['swiper']['on'] = {
  2352. init: function () {
  2353. if (getWindowWidth() <= sliderBreakPoint) {
  2354. this.changeDirection(mdThumbDirection);
  2355. } else {
  2356. this.changeDirection(thumbDirection);
  2357. }
  2358. this.update();
  2359. },
  2360. resize: function () {
  2361. if (getWindowWidth() <= sliderBreakPoint) {
  2362. this.changeDirection(mdThumbDirection);
  2363. } else {
  2364. this.changeDirection(thumbDirection);
  2365. }
  2366. this.update();
  2367. },
  2368. click: function () {
  2369. /* Product thumbs automatic next / previous on click slide */
  2370. if (this.activeIndex == this.clickedIndex) {
  2371. this.slidePrev();
  2372. } else {
  2373. this.slideNext();
  2374. }
  2375. }
  2376. };
  2377. }
  2378. }
  2379. // If user have provided "data-number-pagination" attribute then below code will execute
  2380. var numberPagination = _this.attr('data-number-pagination');
  2381. if (numberPagination != '' && numberPagination != undefined && numberPagination == '1' && sliderOptions['pagination'] != '' && sliderOptions['pagination'] != undefined) {
  2382. sliderOptions['pagination']['renderBullet'] = function (index, className) {
  2383. return '<span class="' + className + '">' + pad(index + 1) + '</span>';
  2384. }
  2385. }
  2386. // If user have provided "data-thumbs" attribute then below code will execute
  2387. var dataThumbs = _this.attr('data-thumbs');
  2388. if (dataThumbs != '' && dataThumbs != undefined && sliderOptions['pagination'] != '' && sliderOptions['pagination'] != undefined) {
  2389. dataThumbs = $.parseJSON(dataThumbs);
  2390. if (typeof (dataThumbs) !== 'undefined' && dataThumbs !== null) {
  2391. sliderOptions['pagination']['renderBullet'] = function (index, className) {
  2392. return '<span class="' + className + '" style="background-image: url( ' + dataThumbs[index] + ' )"></span>';
  2393. }
  2394. }
  2395. }
  2396. sliderOptions['on'] = {
  2397. init: function () {
  2398. let slides = this.slides;
  2399. let activeIndex = this.activeIndex,
  2400. current_slide = this.slides[activeIndex],
  2401. anime_el = current_slide.querySelectorAll('[data-anime]'),
  2402. fancy_el = current_slide.querySelectorAll('[data-fancy-text]');
  2403. if (getWindowWidth() > animeBreakPoint) {
  2404. if (anime_el) {
  2405. anime_el.forEach(element => {
  2406. let options = element.getAttribute('data-anime');
  2407. if (typeof (options) !== 'undefined' && options !== null) {
  2408. options = $.parseJSON(options);
  2409. if (options.el) {
  2410. for (let i = 0; i < element.children.length; i++) {
  2411. element.children[i].style.opacity = 0;
  2412. element.children[i].classList.add('appear');
  2413. }
  2414. } else {
  2415. element.style.opacity = 0;
  2416. element.classList.add('appear');
  2417. element.style.transition = "none";
  2418. }
  2419. animeAnimation(element, options);
  2420. }
  2421. });
  2422. }
  2423. }
  2424. },
  2425. slideChange: function () {
  2426. // Get active slide
  2427. let slides = this.slides;
  2428. let activeIndex = this.activeIndex,
  2429. current_slide = this.slides[activeIndex],
  2430. anime_el = current_slide.querySelectorAll('[data-anime]'),
  2431. fancy_el = current_slide.querySelectorAll('[data-fancy-text]');
  2432. if (getWindowWidth() > animeBreakPoint) {
  2433. if (fancy_el) {
  2434. fancy_el.forEach(element => {
  2435. element.classList.add('appear');
  2436. let fancy_options = element.getAttribute('data-fancy-text');
  2437. if (typeof (fancy_options) !== 'undefined' && fancy_options !== null) {
  2438. fancy_options = $.parseJSON(fancy_options);
  2439. let child = element;
  2440. FancyTextDefault(child, fancy_options);
  2441. element.classList.remove('appear');
  2442. }
  2443. });
  2444. }
  2445. if (anime_el) {
  2446. anime_el.forEach(element => {
  2447. let options = element.getAttribute('data-anime');
  2448. if (typeof (options) !== 'undefined' && options !== null) {
  2449. options = $.parseJSON(options);
  2450. if (options.el) {
  2451. for (let i = 0; i < element.children.length; i++) {
  2452. element.children[i].style.opacity = 0;
  2453. element.children[i].classList.add('appear');
  2454. }
  2455. } else {
  2456. element.style.opacity = 0;
  2457. element.classList.add('appear');
  2458. element.style.transition = "none";
  2459. }
  2460. animeAnimation(element, options);
  2461. element.classList.remove('appear');
  2462. }
  2463. });
  2464. }
  2465. }
  2466. }
  2467. };
  2468. // If swiper has number navigation
  2469. var isNumberPagination = _this.attr('data-swiper-number-line-pagination') || false;
  2470. var isNumberNavigation = _this.attr('data-swiper-number-navigation') || false;
  2471. var isNumberPaginationProgress = _this.attr('data-swiper-number-pagination-progress') || false;
  2472. var showProgress = _this.attr('data-swiper-show-progress') || false;
  2473. var hasGalleryBox = _this.attr('data-gallery-box') || false;
  2474. if (isNumberPagination || isNumberNavigation || isNumberPaginationProgress || hasGalleryBox) {
  2475. sliderOptions['on'] = {
  2476. init: function () {
  2477. if (isNumberPagination || isNumberNavigation || isNumberPaginationProgress) {
  2478. if (sliderOptions.hasOwnProperty('loop') && sliderOptions['loop']) {
  2479. var slideLength = this.slides.length;
  2480. }
  2481. var length = slideLength;
  2482. if (isNumberPaginationProgress) {
  2483. _this.parent().find('.number-next').text('0' + length);
  2484. _this.parent().find('.number-prev').text('01');
  2485. _this.parent().find('.swiper-pagination-progress')[0].style.setProperty('--swiper-progress', (100 / length).toFixed(2) + '%');
  2486. } else {
  2487. _this.parent().find('.number-next').text('02');
  2488. _this.parent().find('.number-prev').text('0' + length);
  2489. if (showProgress)
  2490. _this.parent().find('.swiper-pagination-progress')[0].style.setProperty('--swiper-progress', (100 / length).toFixed(2) + '%');
  2491. }
  2492. }
  2493. if (typeof $.fn.magnificPopup === 'function') {
  2494. if (hasGalleryBox) {
  2495. _this.magnificPopup({
  2496. delegate: 'a',
  2497. type: 'image',
  2498. closeOnContentClick: true,
  2499. closeBtnInside: false,
  2500. gallery: {enabled: true}
  2501. });
  2502. }
  2503. }
  2504. },
  2505. slideChange: function () {
  2506. if (isNumberPagination || isNumberNavigation || isNumberPaginationProgress) {
  2507. if (sliderOptions.hasOwnProperty('loop') && sliderOptions['loop']) {
  2508. var slideLength = this.slides.length;
  2509. }
  2510. var length = this.slides.length,
  2511. active = (this.realIndex) + 1,
  2512. next = active + 1,
  2513. prev = active - 1;
  2514. if (active == 1) {
  2515. prev = length;
  2516. }
  2517. if (active == length) {
  2518. next = 1;
  2519. }
  2520. if (isNumberPaginationProgress) {
  2521. _this.parent().find('.number-prev').each(function () {
  2522. $(this).text(active < 10 ? '0' + active : active);
  2523. });
  2524. _this.parent().find('.swiper-pagination-progress')[0].style.setProperty('--swiper-progress', ((100 / length) * active).toFixed(2) + '%');
  2525. } else {
  2526. _this.parent().find('.number-next').each(function () {
  2527. $(this).text(next < 10 ? '0' + next : next);
  2528. });
  2529. _this.parent().find('.number-prev').each(function () {
  2530. $(this).text(prev < 10 ? '0' + prev : prev);
  2531. });
  2532. if (showProgress)
  2533. _this.parent().find('.swiper-pagination-progress')[0].style.setProperty('--swiper-progress', ((100 / length) * active).toFixed(2) + '%');
  2534. }
  2535. }
  2536. }
  2537. }
  2538. }
  2539. // Move thumb slide on click in product page.
  2540. var thumbClick = _this.attr('data-swiper-thumb-click') || false;
  2541. if (thumbClick && sliderOptions.hasOwnProperty('thumbs')) {
  2542. sliderOptions['thumbs']['swiper']['on'] = {
  2543. click: function (swiper) {
  2544. if (swiper.activeIndex >= swiper.clickedIndex) {
  2545. swiper.slidePrev();
  2546. } else if (swiper.activeIndex < swiper.clickedIndex) {
  2547. swiper.slideNext();
  2548. }
  2549. }
  2550. }
  2551. }
  2552. if (typeof Swiper === 'function') {
  2553. _this.imagesLoaded(function () {
  2554. var swiperObj = new Swiper(swiperItem, sliderOptions);
  2555. swiperObjs.push(swiperObj);
  2556. });
  2557. }
  2558. }
  2559. });
  2560. }
  2561. /* ===================================
  2562. Parallax background
  2563. ====================================== */
  2564. function setParallax() {
  2565. if (!isIE()) {
  2566. if (typeof $.fn.parallax !== 'undefined' && typeof $.fn.parallax !== null) {
  2567. $('[data-parallax-background-ratio]').each(function () {
  2568. var ratio = $(this).attr('data-parallax-background-ratio') || 0.5;
  2569. $(this).parallax('50%', ratio);
  2570. });
  2571. $('[data-parallax-layout-ratio]').each(function () {
  2572. var ratio = $(this).attr('data-parallax-layout-ratio') || 1;
  2573. $(this).parallaxImg(ratio);
  2574. });
  2575. }
  2576. $('[data-parallax-liquid]').each(function () {
  2577. var scale = $(this).attr('data-parallax-scale') || 0;
  2578. var scaleFraction = parseFloat($(this).attr('data-parallax-scale-fraction'));
  2579. var reverse = $(this).attr('data-parallax-reverse') ? $(this).attr('data-parallax-reverse') : false;
  2580. var parallaxTransition = parseFloat($(this).attr('data-parallax-transition')) ? parseFloat($(this).attr('data-parallax-transition')) : 1.5;
  2581. if (typeof $.fn.parallaxLiquidImg !== 'undefined' && typeof $.fn.parallaxLiquidImg !== null) {
  2582. $(this).parallaxLiquidImg(parallaxTransition, parseFloat(scale), scaleFraction, reverse);
  2583. }
  2584. });
  2585. }
  2586. }
  2587. /* ===================================
  2588. Overlap section
  2589. ====================================== */
  2590. // Top overlap section position
  2591. function setOverLayerPosition() {
  2592. if (($('.overlap-section').length > 0 || $('.overlap-section-one-fourth').length > 0 || $('.overlap-section-three-fourth').length > 0)) {
  2593. $('.overlap-section, .overlap-section-one-fourth, .overlap-section-three-fourth').each(function () {
  2594. let _this = $(this),
  2595. overlayBreakpoint = 767;
  2596. if (_this.hasClass('md-overlap-disable')) {
  2597. overlayBreakpoint = 991;
  2598. } else if (_this.hasClass('sm-overlap-disable')) {
  2599. overlayBreakpoint = 767;
  2600. }
  2601. if (getWindowWidth() > overlayBreakpoint) {
  2602. setTimeout(function () {
  2603. _this.imagesLoaded(function () {
  2604. var closestSectionObj = _this.closest('section');
  2605. if (_this.closest('footer').length) {
  2606. closestSectionObj = _this.closest('footer');
  2607. }
  2608. var sectionPaddingTop = parseInt(closestSectionObj.css('padding-top')),
  2609. areaHeight = _this.find('*').outerHeight(),
  2610. overlayTop = areaHeight + sectionPaddingTop;
  2611. if (_this.hasClass('overlap-section-one-fourth')) {
  2612. overlayTop = (areaHeight / 4) - overlayTop;
  2613. } else if (_this.hasClass('overlap-section-three-fourth')) {
  2614. overlayTop = ((areaHeight * 3) / 4) - overlayTop;
  2615. } else {
  2616. overlayTop = (areaHeight / 2) - overlayTop;
  2617. }
  2618. _this.css('margin-top', overlayTop);
  2619. var parentSectionObj = closestSectionObj.prev('.overlap-height'),
  2620. overlapGap = parentSectionObj.find('.overlap-gap-section');
  2621. parentSectionObj.imagesLoaded(function () {
  2622. if (overlapGap.length > 0) {
  2623. var gapSectionHeight = overlapGap.outerHeight() + (Math.abs(overlayTop) - sectionPaddingTop);
  2624. overlapGap.parents('.overlap-height').height(gapSectionHeight);
  2625. }
  2626. });
  2627. });
  2628. }, 500);
  2629. } else {
  2630. setTimeout(function () {
  2631. $('.overlap-height').height('inherit');
  2632. $('.overlap-section, .overlap-section-one-fourth, .overlap-section-three-fourth').css('margin-top', 'inherit');
  2633. }, 500);
  2634. }
  2635. });
  2636. }
  2637. }
  2638. // Bottom overlap section position
  2639. function setBottomOverLayerPosition(delay) {
  2640. if (($('.overlap-section-bottom').length > 0) && getWindowWidth() >= 768) {
  2641. $('.overlap-section-bottom').each(function () {
  2642. var _this = $(this),
  2643. timeOut = (_this.find('.instafeed-wrapper').length > 0) ? delay : 10;
  2644. setTimeout(function () {
  2645. _this.imagesLoaded(function () {
  2646. var areaHeight = _this.outerHeight(),
  2647. overlayerMargin = ((areaHeight / 2) - areaHeight);
  2648. _this.parents('section').next('.overlap-gap-section-bottom').css('margin-top', overlayerMargin);
  2649. _this.parents('section').next('.overlap-gap-section-bottom').css('padding-top', areaHeight);
  2650. });
  2651. }, timeOut);
  2652. });
  2653. } else {
  2654. $('.overlap-gap-section-bottom').css('margin-top', '');
  2655. $('.overlap-gap-section-bottom').css('padding-top', '');
  2656. }
  2657. }
  2658. /* ===================================
  2659. Magic cursor
  2660. ====================================== */
  2661. if ($('.magic-cursor').length > 0) {
  2662. $('<div class="magic-cursor-wrapper"><div id="ball-cursor"><div id="ball-cursor-loader"></div></div></div>').clone(false).appendTo('body');
  2663. if ($('.magic-cursor').hasClass('light')) {
  2664. $('.magic-cursor-wrapper').addClass('magic-cursor-light');
  2665. }
  2666. if ($('.magic-cursor').hasClass('base-color')) {
  2667. $('.magic-cursor-wrapper').addClass('magic-cursor-base-color');
  2668. }
  2669. if ($('.magic-cursor').hasClass('view-cursor')) {
  2670. $('.magic-cursor-wrapper').addClass('magic-view-cursor');
  2671. }
  2672. if ($('.magic-cursor').hasClass('drag-cursor')) {
  2673. $('.magic-cursor-wrapper').addClass('magic-drag-cursor');
  2674. }
  2675. if ($('.magic-cursor').hasClass('round-cursor')) {
  2676. $('.magic-cursor-wrapper').addClass('magic-round-cursor');
  2677. }
  2678. var mouse = {
  2679. x: 0,
  2680. y: 0
  2681. },
  2682. pos = {
  2683. x: 0,
  2684. y: 0
  2685. },
  2686. ratio = .65,
  2687. active = !1,
  2688. ball = document.getElementById('ball-cursor'),
  2689. ballloader = document.getElementById('ball-cursor-loader');
  2690. function mouseMove(e) {
  2691. var a = window.pageYOffset || document.documentElement.scrollTop;
  2692. mouse.x = e.pageX, mouse.y = e.pageY - a
  2693. }
  2694. function updatePosition() {
  2695. active || (pos.x += (mouse.x - pos.x) * ratio, pos.y += (mouse.y - pos.y) * ratio, TweenLite.to(ball, .4, {
  2696. x: pos.x,
  2697. y: pos.y,
  2698. }))
  2699. }
  2700. if (typeof TweenLite !== "undefined") {
  2701. TweenLite.set(ball, {
  2702. xPercent: -50,
  2703. yPercent: -50,
  2704. scale: 0,
  2705. borderWidth: "0",
  2706. opacity: 1
  2707. });
  2708. }
  2709. document.addEventListener("mousemove", mouseMove);
  2710. if (typeof gsap !== "undefined") {
  2711. gsap.ticker.add(updatePosition);
  2712. }
  2713. if (typeof TweenMax !== 'undefined' && typeof TweenMax !== null) {
  2714. $('.magic-cursor').mouseenter(function (e) {
  2715. TweenMax.to('#ball-cursor', 0.3, {
  2716. borderWidth: '2px',
  2717. scale: 1,
  2718. });
  2719. TweenMax.to('#ball-cursor-loader', 0.2, {
  2720. borderWidth: '2px',
  2721. top: 2,
  2722. left: 2
  2723. });
  2724. $('.magic-cursor-wrapper').addClass('sliderhover');
  2725. if ($(this).hasClass('magic-cursor-vertical')) {
  2726. $('.magic-cursor-wrapper').addClass('vertical');
  2727. }
  2728. });
  2729. }
  2730. if (typeof TweenMax !== 'undefined' && typeof TweenMax !== null) {
  2731. $('.magic-cursor').mouseleave(function (e) {
  2732. TweenMax.to('#ball-cursor', 0.3, {
  2733. borderWidth: '2px',
  2734. scale: 1,
  2735. borderColor: 'transparent',
  2736. opacity: 1
  2737. });
  2738. TweenMax.to('#ball-cursor-loader', 0.2, {
  2739. borderWidth: '2px',
  2740. top: 0,
  2741. left: 0
  2742. });
  2743. $('.magic-cursor-wrapper').removeClass('sliderhover');
  2744. });
  2745. }
  2746. }
  2747. $(document).on('mouseenter', '.swiper-button-next, .swiper-button-prev, .swiper-pagination, a:not(.force-magic-cursor)', function () {
  2748. $('.magic-cursor-wrapper').css({'opacity': 0});
  2749. }).on('mouseleave', '.swiper-button-next, .swiper-button-prev, .swiper-pagination, a:not(.force-magic-cursor)', function () {
  2750. $('.magic-cursor-wrapper').css({'opacity': 1});
  2751. });
  2752. /* ===================================
  2753. Box shadow animation
  2754. ====================================== */
  2755. $(window).scroll(function (event) {
  2756. $('[data-shadow-animation="true"]').each(function () {
  2757. addBoxAnimationClass($(this))
  2758. });
  2759. });
  2760. $('[data-shadow-animation="true"]').removeClass('shadow-in');
  2761. $('[data-shadow-animation="true"]').each(function () {
  2762. addBoxAnimationClass($(this))
  2763. });
  2764. function addBoxAnimationClass(boxObj) {
  2765. if (boxObj.length) {
  2766. var w = boxObj.width();
  2767. var h = boxObj.height();
  2768. var offset = boxObj.offset();
  2769. var right = offset.left + parseInt(boxObj.width());
  2770. var bottom = offset.top + parseInt(boxObj.height());
  2771. var visibleX = Math.max(0, Math.min(w, window.pageXOffset + window.innerWidth - offset.left, right - window.pageXOffset));
  2772. var visibleY = Math.max(0, Math.min(h, window.pageYOffset + window.innerHeight - offset.top, bottom - window.pageYOffset));
  2773. var visible = visibleX * visibleY / (w * h);
  2774. if (visible >= 0.5) {
  2775. if (typeof boxObj.attr('data-animation-delay') !== 'undefined' && boxObj.attr('data-animation-delay') > 10) {
  2776. setTimeout(function () {
  2777. boxObj.addClass('shadow-in');
  2778. }, boxObj.attr('data-animation-delay'));
  2779. } else {
  2780. boxObj.addClass('shadow-in');
  2781. }
  2782. }
  2783. }
  2784. }
  2785. /* ===================================
  2786. Skrollr animation
  2787. ====================================== */
  2788. var skroller;
  2789. function initSkrollr() {
  2790. if (typeof skrollr !== 'undefined' && typeof skrollr !== null) {
  2791. skroller = skrollr.init({
  2792. 'forceHeight': false,
  2793. 'smoothScrollingDuration': 1000,
  2794. 'mobileCheck': function () {
  2795. return false;
  2796. }
  2797. });
  2798. }
  2799. }
  2800. function reInitSkrollr() {
  2801. destroySkrollr();
  2802. if ($(window).width() >= 1200) {
  2803. setTimeout(function () {
  2804. initSkrollr();
  2805. }, 1000);
  2806. }
  2807. }
  2808. function destroySkrollr() {
  2809. if (typeof skroller !== typeof undefined && skroller != 'undefined') {
  2810. skroller.destroy();
  2811. }
  2812. }
  2813. if ($(window).width() >= 1200) {
  2814. initSkrollr();
  2815. }
  2816. /* ===================================
  2817. Particles
  2818. ====================================== */
  2819. var particleDefaultOptions = {
  2820. particles: {
  2821. number: {
  2822. value: 80,
  2823. density: {
  2824. enable: !1,
  2825. value_area: 800
  2826. }
  2827. },
  2828. color: {
  2829. value: ["#fdc14c", "#fd5c4c", "#48bb0f"]
  2830. },
  2831. shape: {
  2832. type: "circle"
  2833. },
  2834. size: {
  2835. value: 10,
  2836. random: !0,
  2837. anim: {
  2838. enable: !0,
  2839. speed: 1
  2840. }
  2841. },
  2842. opacity: {
  2843. value: 0.5,
  2844. random: false
  2845. },
  2846. move: {
  2847. direction: "right",
  2848. attract: {
  2849. enable: !0
  2850. }
  2851. },
  2852. line_linked: {
  2853. enable: !1
  2854. }
  2855. },
  2856. interactivity: {
  2857. events: {
  2858. onhover: {
  2859. enable: !1
  2860. },
  2861. onclick: {
  2862. enable: !1
  2863. }
  2864. }
  2865. },
  2866. "retina_detect": true
  2867. };
  2868. var particleItems = $('[data-particle="true"]');
  2869. if (typeof particlesJS === 'function' && particleItems.length) {
  2870. $.each(particleItems, function (index, particleItem) {
  2871. var particleId = $(particleItem).attr('id');
  2872. var particleItemOptions = $(particleItem).attr('data-particle-options');
  2873. if (particleItemOptions != 'undefined' && typeof particleItemOptions !== typeof undefined) {
  2874. particleItemOptions = JSON.parse(particleItemOptions);
  2875. } else {
  2876. particleItemOptions = particleDefaultOptions;
  2877. }
  2878. particlesJS(particleId, particleItemOptions);
  2879. });
  2880. }
  2881. /* ===================================
  2882. SVG animated image mask
  2883. ====================================== */
  2884. $('.animatedSvgPath').each(function () {
  2885. var animePath = $(this);
  2886. var paths = animePath.attr('pathdata:id').split(';');
  2887. paths.splice(paths.length, 0, animePath.attr('d'));
  2888. animate(animePath[0], {
  2889. duration: 10000,
  2890. ease: 'cubicBezier(0.5, 0, 0.5, 1)',
  2891. d: paths,
  2892. loop: true
  2893. });
  2894. });
  2895. /* ===================================
  2896. Custom cursor
  2897. ====================================== */
  2898. var customCursorInit = false;
  2899. handleCustomCursor();
  2900. // Custom cursor issue
  2901. forceHideCustomCursor();
  2902. $(window).resize(function () {
  2903. if (!customCursorInit && !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))) {
  2904. handleCustomCursor();
  2905. }
  2906. forceHideCustomCursor();
  2907. });
  2908. function forceHideCustomCursor() {
  2909. setTimeout(function () {
  2910. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  2911. $('.cursor-page-inner').hide();
  2912. } else {
  2913. $('.cursor-page-inner').show();
  2914. }
  2915. }, 250);
  2916. }
  2917. function handleCustomCursor() {
  2918. if ($('body').hasClass('custom-cursor')) {
  2919. const cursorInnerEl = document.querySelector('.circle-cursor-inner');
  2920. const cursorOuterEl = document.querySelector('.circle-cursor-outer');
  2921. // Return early if elements are not found
  2922. if (!cursorInnerEl || !cursorOuterEl) {
  2923. console.warn('Custom cursor elements not found.');
  2924. return;
  2925. }
  2926. customCursorInit = true;
  2927. let lastY, lastX;
  2928. let magneticFlag = false;
  2929. let anchorHover = false;
  2930. // Document - mouse move
  2931. window.onmousemove = function (event) {
  2932. if (!magneticFlag) {
  2933. cursorOuterEl.style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')';
  2934. }
  2935. if (cursorInnerEl.style.opacity = '0') {
  2936. cursorInnerEl.style.opacity = '1';
  2937. }
  2938. cursorInnerEl.style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')';
  2939. lastY = event.clientY;
  2940. lastX = event.clientX;
  2941. }
  2942. // Link - mouse enter
  2943. $('body').on('mouseenter', 'a', function () {
  2944. cursorInnerEl.classList.add('cursor-link-hover');
  2945. cursorOuterEl.classList.add('cursor-link-hover');
  2946. anchorHover = true;
  2947. });
  2948. // Disable custom cursor when mouse enter in the magic cursor element
  2949. $('body').on('mouseenter', '.magic-cursor', function () {
  2950. cursorInnerEl.style.visibility = 'hidden';
  2951. cursorOuterEl.style.visibility = 'hidden';
  2952. });
  2953. // Enable custom cursor when mouse leave from the magic cursor element
  2954. $('body').on('mouseleave', '.magic-cursor', function () {
  2955. cursorInnerEl.style.visibility = 'visible';
  2956. cursorOuterEl.style.visibility = 'visible';
  2957. });
  2958. // Link - mouse leave
  2959. $('body').on('mouseleave', 'a', function () {
  2960. if ($(this).is('a') && $(this).closest('.cursor-as-pointer').length) {
  2961. return;
  2962. }
  2963. cursorInnerEl.classList.remove('cursor-link-hover');
  2964. cursorOuterEl.classList.remove('cursor-link-hover');
  2965. anchorHover = false;
  2966. });
  2967. // Cursor - mouse enter
  2968. $('body').on('mouseenter', '.rounded-box', function () {
  2969. const $elem = $(this);
  2970. const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
  2971. if (anchorHover) {
  2972. cursorInnerEl.classList.remove('cursor-link-hover');
  2973. cursorOuterEl.classList.remove('cursor-link-hover');
  2974. }
  2975. cursorOuterEl.style.transition = 'all .2s ease-out';
  2976. cursorOuterEl.style.transform = 'translate(' + $elem.offset().left + 'px, ' + ($elem.offset().top - scrollTop) + 'px' + ')';
  2977. cursorOuterEl.style.width = $elem.width() + 'px';
  2978. cursorOuterEl.style.height = $elem.height() + 'px';
  2979. cursorOuterEl.style.marginLeft = 0;
  2980. cursorOuterEl.style.marginTop = 0;
  2981. magneticFlag = true;
  2982. });
  2983. // Cursor - mouse leave
  2984. $('body').on('mouseleave', '.rounded-box', function () {
  2985. if (anchorHover) {
  2986. cursorInnerEl.classList.add('cursor-link-hover');
  2987. cursorOuterEl.classList.add('cursor-link-hover');
  2988. }
  2989. cursorOuterEl.style.transition = null;
  2990. cursorOuterEl.style.width = null;
  2991. cursorOuterEl.style.height = null;
  2992. cursorOuterEl.style.marginLeft = null;
  2993. cursorOuterEl.style.marginTop = null;
  2994. magneticFlag = false;
  2995. });
  2996. cursorInnerEl.style.visibility = 'visible';
  2997. cursorOuterEl.style.visibility = 'visible';
  2998. }
  2999. }
  3000. /* ===================================
  3001. Stack animataion
  3002. ====================================== */
  3003. stackAnimation();
  3004. var stackLastScroll = 0;
  3005. function stackAnimation() {
  3006. windowScrollTop = window.pageYOffset || document.documentElement.scrollTop;
  3007. $('.stack-box').each(function () {
  3008. if ($(window).width() > 1199) {
  3009. var _this = $(this);
  3010. var stackItems = _this.find('.stack-item');
  3011. if (stackItems.length) {
  3012. if (windowScrollTop > stackLastScroll) {
  3013. _this.addClass('forward');
  3014. _this.removeClass('reverse');
  3015. } else {
  3016. _this.removeClass('forward');
  3017. _this.addClass('reverse');
  3018. }
  3019. for (let i = 0; i < stackItems.length - 1; i++) {
  3020. var stackBoxHeight = (_this.height() / (_this.find('.stack-item').length)) * i;
  3021. var stackTopPosition = _this.offset().top;
  3022. if ((windowScrollTop - stackTopPosition) > stackBoxHeight) {
  3023. var yMove = windowScrollTop - stackTopPosition - stackBoxHeight;
  3024. if (yMove > _this.outerHeight()) {
  3025. yMove = _this.outerHeight();
  3026. }
  3027. $(stackItems[i]).css({'height': 'calc(100vh - ' + yMove + 'px)'});
  3028. $(stackItems[i]).addClass('active');
  3029. } else {
  3030. $(stackItems[i]).css({'height': 'calc(100vh - 0px)'});
  3031. $(stackItems[i]).removeClass('active');
  3032. }
  3033. }
  3034. }
  3035. } else {
  3036. $('.stack-box .stack-item').css({'height': 'inherit'});
  3037. }
  3038. });
  3039. stackLastScroll = windowScrollTop;
  3040. }
  3041. $(window).scroll(function () {
  3042. stackAnimation();
  3043. });
  3044. /* ===================================
  3045. Image tilt 3d effect using atropos
  3046. ====================================== */
  3047. var atroposItems = document.querySelectorAll('[data-atropos]')
  3048. function initAtropos() {
  3049. if (atroposItems.length && $(window).width() > 1199) {
  3050. atroposItems.forEach(function (atroposItem) {
  3051. var myAtropos = Atropos({
  3052. el: atroposItem
  3053. });
  3054. });
  3055. }
  3056. }
  3057. if (typeof Atropos !== 'undefined' && Atropos !== null) {
  3058. initAtropos();
  3059. }
  3060. function destroyAtropos() {
  3061. if (atroposItems.length && $(window).width() > 1199) {
  3062. atroposItems.forEach(function (atroposItem) {
  3063. if (atroposItem.__atropos__) {
  3064. atroposItem.__atropos__.destroy();
  3065. }
  3066. });
  3067. }
  3068. }
  3069. /* ===================================
  3070. Sticky vertical strip - add dark section class
  3071. ====================================== */
  3072. var getElementsInArea = (function (docElm) {
  3073. var viewportHeight = docElm.clientHeight;
  3074. return function (e, opts) {
  3075. var found = [], i;
  3076. if (e && e.type == 'resize') {
  3077. viewportHeight = docElm.clientHeight;
  3078. }
  3079. for (i = opts.elements.length; i--; ) {
  3080. var elm = opts.elements[i],
  3081. pos = elm.getBoundingClientRect(),
  3082. topPerc = pos.top / viewportHeight * 100,
  3083. bottomPerc = pos.bottom / viewportHeight * 100,
  3084. middle = (topPerc + bottomPerc) / 2,
  3085. inViewport = middle > opts.zone[1] && middle < (100 - opts.zone[1]);
  3086. elm.classList.toggle(opts.markedClass, inViewport);
  3087. if (inViewport) {
  3088. found.push(elm);
  3089. }
  3090. }
  3091. };
  3092. })(document.documentElement);
  3093. $(window).on('scroll resize load', function (e) {
  3094. getElementsInArea(e, {
  3095. elements: document.querySelectorAll('.section-dark'),
  3096. markedClass: 'section-dark-highlight',
  3097. zone: [10, 10]
  3098. });
  3099. if ($('.section-dark-highlight').length > 0) {
  3100. $('.sticky-wrap').addClass('sticky-highlight');
  3101. } else {
  3102. $('.sticky-wrap').removeClass('sticky-highlight');
  3103. }
  3104. });
  3105. $(document).on('appear', 'footer', function (e) {
  3106. $('.sticky-wrap').addClass('sticky-hidden');
  3107. }).on('disappear', 'footer', function (e) {
  3108. $('.sticky-wrap').removeClass('sticky-hidden');
  3109. });
  3110. /* ===================================
  3111. Quantity input
  3112. ====================================== */
  3113. $('.qty-plus').click(function () {
  3114. var th = $(this).closest('.quantity').find('.qty-text');
  3115. th.val(+th.val() + 1);
  3116. });
  3117. $('.qty-minus').click(function () {
  3118. var th = $(this).closest('.quantity').find('.qty-text');
  3119. if (th.val() > 1)
  3120. th.val(+th.val() - 1);
  3121. });
  3122. /* ===================================
  3123. Infinite looping animation
  3124. ====================================== */
  3125. const wrapperEl = document.querySelector('.looping-wrapper');
  3126. const numberOfEls = 100;
  3127. const duration = 6000;
  3128. const delay = duration / numberOfEls;
  3129. // Create timeline
  3130. let tl = anime.createTimeline({
  3131. loop: true,
  3132. loopDelay: -900,
  3133. autoplay: true,
  3134. defaults: {
  3135. ease: 'inOutSine',
  3136. },
  3137. });
  3138. function createEl(i) {
  3139. const el = document.createElement('div');
  3140. let rotate = (360 / numberOfEls) * i;
  3141. const translateY = -50;
  3142. el.classList.add('el');
  3143. el.style.transform = 'rotate(' + rotate + 'deg) translateY(' + translateY + '%)';
  3144. tl.add(el, {
  3145. keyframes: [
  3146. {rotate: `${rotate + 10}deg`, translateY: `${translateY + 10}%`, scale: 1.25},
  3147. {rotate: `${rotate}deg`, translateY: `${translateY}%`, scale: 1}
  3148. ],
  3149. delay: i * delay,
  3150. onComplete: () => {
  3151. el.style.transform = `rotate(${rotate}deg) translateY(${translateY}%) scale(1)`;
  3152. },
  3153. }, 0);
  3154. if (wrapperEl) {
  3155. wrapperEl.appendChild(el);
  3156. }
  3157. }
  3158. for (var i = 0; i < numberOfEls; i++) {
  3159. createEl(i);
  3160. }
  3161. /* ===================================
  3162. Background color change on scroll - Adaptive Backgrounds
  3163. ====================================== */
  3164. window.sections = [...document.querySelectorAll('[data-background]')];
  3165. window.lastScrollTop = window.pageYOffset;
  3166. let activeSection;
  3167. onScroll();
  3168. window.addEventListener('scroll', onScroll);
  3169. function onScroll() {
  3170. if (window.sections.length > 0) {
  3171. const section = window.sections
  3172. .map(section => {
  3173. const el = section;
  3174. const rect = el.getBoundingClientRect();
  3175. return {el, rect};
  3176. })
  3177. .find(section => section.rect.bottom >= (window.innerHeight * 0.5));
  3178. if (section && section.el !== activeSection) {
  3179. activeSection = section.el;
  3180. const sectionBg = activeSection.getAttribute('data-background');
  3181. activeSection.closest(".page-content").querySelectorAll("[data-background]").forEach(item => item.classList.remove("active"))
  3182. activeSection.classList.add("active")
  3183. if (typeof gsap !== "undefined") {
  3184. gsap.to(activeSection.closest(".page-content"), {backgroundColor: sectionBg})
  3185. }
  3186. }
  3187. }
  3188. }
  3189. /* ===================================
  3190. Cookies set
  3191. ====================================== */
  3192. if (typeof $.cookie === 'function') {
  3193. if ($('body').find('#cookies-model').length > 0) {
  3194. setTimeout(function () {
  3195. var cookieModel = $('#cookies-model'),
  3196. cookieConsentclosed = $.cookie('cookieConsent');
  3197. if (cookieConsentclosed == 'closed') {
  3198. cookieModel.remove();
  3199. } else {
  3200. cookieModel.show();
  3201. }
  3202. cookieModel.find('[data-accept-btn]').on('click', function (e) {
  3203. e.preventDefault();
  3204. var expiresDays = 1;
  3205. cookieModel.remove();
  3206. $.cookie('cookieConsent', 'closed', {expires: expiresDays, path: '/'});
  3207. });
  3208. }, 1000);
  3209. }
  3210. }
  3211. /* ===================================
  3212. Back to top scroll
  3213. ====================================== */
  3214. $(document).on('click', '.scroll-top', function () {
  3215. $('html, body').animate({scrollTop: 0}, 800);
  3216. return false;
  3217. });
  3218. function scrollIndicator() {
  3219. var scrollTop = document.documentElement.scrollTop;
  3220. if (scrollTop > 200) {
  3221. $('.scroll-progress').addClass('visible');
  3222. } else {
  3223. $('.scroll-progress').removeClass('visible');
  3224. }
  3225. var scrollHeight = document.documentElement.scrollHeight;
  3226. var windowHeight = document.documentElement.clientHeight;
  3227. var maxScrollTop = scrollHeight - windowHeight;
  3228. var scrollTop = document.documentElement.scrollTop;
  3229. var scrollPercentage = (scrollTop / (maxScrollTop - 200)) * 100;
  3230. $('.scroll-point').css('height', Math.min(scrollPercentage, 100) + '%');
  3231. /***** Theme demos button scroll to show *****/
  3232. var scrollPos = $(window).scrollTop();
  3233. if (scrollPos > 150) {
  3234. $('.theme-demos').fadeIn(600);
  3235. }
  3236. }
  3237. $(window).scroll(function () {
  3238. scrollIndicator();
  3239. });
  3240. /* ===================================
  3241. Trusted customers
  3242. ====================================== */
  3243. $('.bg-more-trusted .btn').click(function (e) {
  3244. e.preventDefault();
  3245. $(this).parent().parent().addClass('show-trusted-customers');
  3246. });
  3247. /* ===================================
  3248. Theme demo panel
  3249. ====================================== */
  3250. // var themeDemoHTML = '<div class="theme-demos"><div class="demo-button-wrapper"><div class="buy-theme"><a href="https://1.envato.market/R53mL2" target="_blank"><div class="theme-wrapper"><div><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 22.284 25.436"><path d="M19.314,9.285c-.745-.414-2.882-.158-5.449.637-4.492,3.07-8.283,7.594-8.547,14.858-.048.174-.491-.024-.579-.077a10.346,10.346,0,0,1-.681-8.3c.189-.314-.428-.7-.539-.591a12.683,12.683,0,0,0-1.765,2.278,11.061,11.061,0,0,0,19.33,10.759c3.438-6.161.246-18.432-1.77-19.558Z" transform="translate(-0.32 -9.089)" fill="#fff"></path></svg></div></div></a></div><div class="all-demo"><a href="#"><div class="theme-wrapper"><div>56+ Pre-built sites</div></div></a></div></div><span class="close-popup fs-22 text-dark-gray w-40px h-40px d-flex justify-content-center align-items-center"><i class="fa-solid fa-xmark"></i></span></div>';
  3251. // var themeDemoData = '<section class="d-flex justify-content-center theme-demos-main"><div class="w-100 demos-wrapper"><div class="w-100 demos-wrapper-inner"><div class="w-100 text-center mb-15px"><h3 class="text-dark-gray fw-700 ls-minus-1px mb-35px pe-20 ps-20">56+ Pre-built websites</h3></div><div class=container-fluid><div class=row><div class=col-12><ul class="grid grid-4col gutter-extra-large lg-grid-2col md-grid-2col portfolio-wrapper sm-grid-1col xl-grid-3col xs-grid-1col xxl-grid-4col"><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-corporate.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-corporate.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-corporate.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Corporate</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-restaurant.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-restaurant.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-restaurant.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Restaurant</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-branding-agency.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-branding-agency.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-branding-agency.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Branding agency</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-elearning.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-elearning.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-elearning.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">eLearning</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-it-business.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-it-business.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-it-business.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">IT Business</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-data-analysis.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-data-analysis.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-data-analysis.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Data analysis</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-hotel-and-resort.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-hotel-and-resort.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-hotel-and-resort.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Hotel resort</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-scattered-portfolio.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-scattered-portfolio.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-scattered-portfolio.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Scattered portfolio</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-beauty-salon.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-beauty-salon.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-beauty-salon.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Beauty salon</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-product-showcase.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-product.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-product-showcase.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Product showcase</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-medical.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-medical.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-medical.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Medical</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-marketing.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-marketing.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-marketing.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Marketing</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-gym-and-fitness.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-gym-and-fitness.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-gym-and-fitness.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Gym & fitness</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-design-agency.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-design-agency.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-design-agency.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Design agency</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-accounting.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-accounting.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-accounting.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Accounting</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-fashion-store.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-fashion-store.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-fashion-store.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Fashion store</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-interactive-portfolio.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-interactive-portfolio.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-interactive-portfolio.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Interactive portfolio</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-yoga-and-meditation.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-yoga-and-meditation.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-yoga-and-meditation.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Yoga & meditation</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-travel-agency.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-travel-agency.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-travel-agency.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Travel agency</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-photography.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-photography.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-photography.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Photography</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-ebook.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-ebook.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-ebook.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">eBook</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-conference.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-conference.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-conference.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Conference</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-freelancer.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-freelancer.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-freelancer.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Freelancer</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-lawyer.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-lawyer.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-lawyer.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Lawyer</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-blogger.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-blogger.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-blogger.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Blogger</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-business.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-business.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-business.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Business</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-horizontal-portfolio.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-horizontal-portfolio.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-horizontal-portfolio.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Horizontal portfolio</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-finance.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-finance.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-finance.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Finance</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-decor-store.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-decor-store.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-decor-store.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Decor store</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-wedding-invitation.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-wedding-invitation.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-wedding-invitation.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Wedding invitation</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-vertical-portfolio.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-vertical-portfolio.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-vertical-portfolio.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Vertical portfolio</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-pizza-parlor.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-pizza-parlor.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-pizza-parlor.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Pizza parlor</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-music-onepage.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-music.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-music-onepage.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">music</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-magazine.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-magazine.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-magazine.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Magazine</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-charity.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-charity.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-charity.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Charity</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-hosting.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-hosting.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-hosting.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Hosting</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-jewellery-store.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-jewellery-store.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-jewellery-store.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Jewellery store</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-architecture.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-architecture.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-architecture.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Architecture</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-minimal-portfolio.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-minimal-portfolio.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-minimal-portfolio.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Minimal portfolio</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-digital-agency.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-digital-agency.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-digital-agency.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Digital agency</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-consulting.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-consulting.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-consulting.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Consulting</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-application.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-application.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-application.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Application</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-real-estate.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-real-estate.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-real-estate.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Real estate</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-seo-agency.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-seo-agency.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-seo-agency.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Seo agency</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-green-energy.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-green-energy.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-green-energy.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Green energy</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-logistics.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-logistics.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-logistics.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Logistics</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-cryptocurrency.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-cryptocurrency.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-cryptocurrency.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Cryptocurrency</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-elder-care.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-elder-care.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-elder-care.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Elder care</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-spa-salon.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-spa-salon.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-spa-salon.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Spa salon</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-barber.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-barber.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-barber.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Barber</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-web-agency.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-web-agency.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-web-agency.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Web agency</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-startup.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-startup.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-startup.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Startup</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-recruitment.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-recruitment.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-recruitment.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Recruitment</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-branding-studio.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-branding-studio.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-branding-studio.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Branding studio</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-clothing-store.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-clothing-store.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-clothing-store.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Clothing store</a></div></div><li class=grid-item><div class="bg-white border-radius-10px box-shadow-medium box-shadow-quadruple-large-hover p-10px"><div class=portfolio-image><a href=demo-modern-business.html target=_blank><img alt=""class="w-100 border-radius-6px"src=images/demo-modern-business.jpg></a></div><div class="text-center pb-10px portfolio-caption pt-15px"><a href=demo-modern-business.html target=_blank class="text-dark-gray fw-600 text-dark-gray-hover">Modern business</a></div></div></ul></div></div></div><div class="w-100 text-center"><a href=https://1.envato.market/R53mL2 target=_blank class="btn btn-box-shadow btn-dark-gray btn-large btn-rounded btn-switch-text mt-50px text-transform-none"><span><span class=btn-double-text data-text="Purchase Crafto">Purchase Crafto</span> <span><i class="feather icon-feather-shopping-cart"></i></span></span></a></div></div></div></section>';
  3252. // $('body:not( .landing-page )').append(themeDemoHTML);
  3253. $(document).on('click', '.all-demo', function () {
  3254. var themeDemosObj = $(this).parents('.theme-demos');
  3255. if (!themeDemosObj.hasClass('active')) {
  3256. themeDemosObj.append(themeDemoData);
  3257. themeDemosObj.addClass('active');
  3258. $('body').addClass('overflow-hidden');
  3259. } else {
  3260. themeDemosObj.removeClass('active');
  3261. $('body').removeClass('overflow-hidden');
  3262. }
  3263. });
  3264. var timer;
  3265. $(document).on('click', '.close-popup', function () {
  3266. var themeDemosObj = $(this).parents('.theme-demos');
  3267. themeDemosObj.removeClass('active');
  3268. $('body').removeClass('overflow-hidden');
  3269. clearTimeout(timer);
  3270. timer = setTimeout(function () {
  3271. $('.theme-demos-main').animate({scrollTop: '0'}, 'slow');
  3272. }, 800);
  3273. });
  3274. $(document).on('keydown', function (event) {
  3275. if (event.key == "Escape") {
  3276. var themeDemosObj = $('.theme-demos');
  3277. themeDemosObj.removeClass('active');
  3278. $('body').removeClass('overflow-hidden');
  3279. clearTimeout(timer);
  3280. timer = setTimeout(function () {
  3281. $('.theme-demos-main').animate({scrollTop: '0'}, 'slow');
  3282. }, 800);
  3283. }
  3284. });
  3285. $(".all-demo a").click(function (event) {
  3286. event.preventDefault();
  3287. });
  3288. /* ===================================
  3289. Stack card animataion
  3290. ====================================== */
  3291. $(document).ready(function () {
  3292. class ScrollObserver {
  3293. constructor(target, options) {
  3294. this.target = target;
  3295. this.offsetTop = options.offsetTop || 0;
  3296. this.offsetBottom = options.offsetBottom || window.innerHeight;
  3297. this.callback = options.onScroll || function () { };
  3298. this.triggerOffset = options.triggerOffset || 0.6;
  3299. this.ticking = false;
  3300. this.handleScroll = this.handleScroll.bind(this);
  3301. this.handleResize = this.handleResize.bind(this);
  3302. $(window).on('scroll', this.handleScroll);
  3303. $(window).on('resize', this.handleResize);
  3304. this.handleScroll();
  3305. }
  3306. handleScroll() {
  3307. if (!this.ticking) {
  3308. window.requestAnimationFrame(() => {
  3309. const rect = this.target.getBoundingClientRect();
  3310. const start = this.offsetTop;
  3311. const end = this.offsetBottom;
  3312. let percent = (end - rect.top) / (end - start);
  3313. percent = (percent - this.triggerOffset) / (1 - this.triggerOffset);
  3314. percent = Math.min(Math.max(percent, 0), 1);
  3315. this.callback(percent);
  3316. this.ticking = false;
  3317. });
  3318. this.ticking = true;
  3319. }
  3320. }
  3321. handleResize() {
  3322. this.offsetBottom = window.innerHeight;
  3323. this.handleScroll();
  3324. }
  3325. }
  3326. function interpolate(from, to, percent) {
  3327. return from + (to - from) * percent;
  3328. }
  3329. // Loop through each cards section separately
  3330. $('.cards').each(function () {
  3331. const $cardsContainer = $(this);
  3332. const mode = $cardsContainer.attr('data-scale') || 'true';
  3333. const topDataSpace = parseInt($cardsContainer.attr('data-top-space')) || 0;
  3334. const topPadding = parseInt($cardsContainer.attr('data-top-padding')) || 0;
  3335. const $cards = $cardsContainer.find('.stack-item');
  3336. const total = $cards.length;
  3337. $cards.each(function (index) {
  3338. const $card = $(this);
  3339. const $inner = $card.find('.stack-card-item');
  3340. const topSpace = topDataSpace + index * topDataSpace;
  3341. const offset = topPadding + index * topPadding;
  3342. $card.css('padding-top', `${offset}px`);
  3343. $card.css('top', `${topSpace}px`);
  3344. if (index === total - 1)
  3345. return;
  3346. if (mode === 'true') {
  3347. const $nextCard = $cards.eq(index + 1);
  3348. const minScale = 1 - (total - index - 1) * 0.1;
  3349. new ScrollObserver($nextCard[0], {
  3350. offsetTop: offset,
  3351. offsetBottom: window.innerHeight,
  3352. triggerOffset: 0.6,
  3353. onScroll: (percent) => {
  3354. if (percent <= 0) {
  3355. $inner.css('transform', 'scale(1)');
  3356. return;
  3357. }
  3358. const scale = interpolate(1, minScale, percent);
  3359. $inner.css('transform', `scale(${scale})`);
  3360. }
  3361. });
  3362. }
  3363. });
  3364. if (mode === 'false') {
  3365. $(window).on('scroll resize', function () { }).trigger('scroll');
  3366. }
  3367. });
  3368. });
  3369. /* ===================================
  3370. Crafto progressive blur
  3371. ====================================== */
  3372. $(document).ready(function () {
  3373. const blurContainer = $('.crafto-progressive-blur');
  3374. const blurTrigger = blurContainer.attr('blur-bottom');
  3375. const startBlur = 0.15625;
  3376. const blurMultiplier = 2;
  3377. const totalLayers = 8;
  3378. const rangePerLayer = 100 / totalLayers;
  3379. let blurInitialized = false;
  3380. function initializeBlurLayers() {
  3381. blurContainer.empty();
  3382. for (let i = 0; i < totalLayers; i++) {
  3383. const blurValue = startBlur * Math.pow(blurMultiplier, i);
  3384. const start = i * rangePerLayer;
  3385. const end = (i + 1) * rangePerLayer;
  3386. const maskGradient = `linear-gradient(to top, rgba(0,0,0,0) ${start}%, rgba(0,0,0,1) ${end}%)`;
  3387. const div = $('<div></div>').css({
  3388. 'backdrop-filter': `blur(${blurValue}px)`,
  3389. '-webkit-backdrop-filter': `blur(${blurValue}px)`,
  3390. 'mask-image': maskGradient,
  3391. '-webkit-mask-image': maskGradient
  3392. });
  3393. blurContainer.append(div);
  3394. }
  3395. blurContainer.css('visibility', 'visible');
  3396. blurInitialized = true;
  3397. }
  3398. function removeBlurLayers() {
  3399. blurContainer.empty();
  3400. blurContainer.css('visibility', 'hidden');
  3401. blurInitialized = false;
  3402. }
  3403. function isAtBottom() {
  3404. return (window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 1);
  3405. }
  3406. // Init based on attribute
  3407. if (blurTrigger === 'no') {
  3408. if (!isAtBottom()) {
  3409. initializeBlurLayers();
  3410. }
  3411. $(window).on('scroll', function () {
  3412. if (!isAtBottom() && !blurInitialized) {
  3413. initializeBlurLayers();
  3414. } else if (isAtBottom() && blurInitialized) {
  3415. removeBlurLayers();
  3416. }
  3417. });
  3418. } else {
  3419. // Always show blur by default
  3420. initializeBlurLayers();
  3421. }
  3422. });
  3423. })(jQuery);
  3424. /* ===================================
  3425. Google map
  3426. ====================================== */
  3427. function initMap() {
  3428. $('.map').each(function (e) {
  3429. let _this = $(this),
  3430. mapOptions = _this.attr('data-map-options');
  3431. // Convert String into the Json
  3432. if (typeof (mapOptions) !== 'undefined' && mapOptions !== null) {
  3433. mapOptions = $.parseJSON(mapOptions);
  3434. }
  3435. let lat = mapOptions.lat ? mapOptions.lat : 19.07,
  3436. lng = mapOptions.lng ? mapOptions.lng : 72.87,
  3437. marker = mapOptions.marker,
  3438. popup = mapOptions.popup;
  3439. switch (mapOptions.style && mapOptions.style.toLowerCase()) {
  3440. case 'retro':
  3441. map_style = Retro
  3442. break;
  3443. case 'standard':
  3444. map_style = Standard
  3445. break;
  3446. case 'silver':
  3447. map_style = Silver
  3448. break;
  3449. case 'dark':
  3450. map_style = Dark
  3451. break;
  3452. case 'night':
  3453. map_style = Night
  3454. break;
  3455. case 'aubergine':
  3456. map_style = Aubergine
  3457. break;
  3458. default:
  3459. map_style = Silver
  3460. }
  3461. // Google Map variable
  3462. const gmap = new google.maps.Map(this, {
  3463. zoom: 13,
  3464. center: new google.maps.LatLng(lat, lng),
  3465. mapTypeId: google.maps.MapTypeId.READMAP,
  3466. mapId: '4687c1d12bdf0955',
  3467. });
  3468. let styledMapType = new google.maps.StyledMapType(map_style, {name: 'Styled Map'});
  3469. gmap.mapTypes.set('styled_map', styledMapType);
  3470. gmap.setMapTypeId('styled_map');
  3471. // InforWindow variable
  3472. const infowindow = new google.maps.InfoWindow({
  3473. content: popup && popup.html,
  3474. maxWidth: 300,
  3475. });
  3476. infowindow.setPosition(new google.maps.LatLng(lat, lng));
  3477. // Marker Options
  3478. if (marker !== null && marker !== undefined) {
  3479. // Custom HTML Marker
  3480. if (marker.type.toLowerCase() === 'html') {
  3481. function HTMLMarker(lat, lng) {
  3482. this.lat = lat;
  3483. this.lng = lng;
  3484. this.pos = new google.maps.LatLng(lat, lng);
  3485. }
  3486. HTMLMarker.prototype = new google.maps.OverlayView();
  3487. //init html
  3488. HTMLMarker.prototype.onAdd = function () {
  3489. div = document.createElement('DIV');
  3490. div.className = `arrow_box ${marker.class ? ' ' + marker.class : ''}`;
  3491. div.innerHTML = `<span style='background-color: ${marker.color}; border-color: ${marker.color}'></span><span style='background-color: ${marker.color}; border-color: ${marker.color}'></span>`;
  3492. div.style.setProperty('background-color', marker.color);
  3493. let panes = this.getPanes();
  3494. panes.overlayImage.appendChild(div);
  3495. let flag = false;
  3496. if (popup.defaultOpen === true) {
  3497. flag = true;
  3498. infowindow.setOptions({pixelOffset: new google.maps.Size(10, -30)});
  3499. infowindow.open(gmap);
  3500. }
  3501. google.maps.event.addListener(div, "click", function (event) {
  3502. if (popup) {
  3503. infowindow.setOptions({pixelOffset: new google.maps.Size(10, -30)});
  3504. if (flag === false) {
  3505. infowindow.open(gmap);
  3506. flag = true;
  3507. } else {
  3508. infowindow.close();
  3509. flag = false;
  3510. }
  3511. }
  3512. });
  3513. }
  3514. HTMLMarker.prototype.draw = function () {
  3515. let overlayProjection = this.getProjection();
  3516. let position = overlayProjection.fromLatLngToDivPixel(this.pos);
  3517. let panes = this.getPanes();
  3518. panes.overlayImage.style.left = position.x + 'px';
  3519. panes.overlayImage.style.top = position.y - 30 + 'px';
  3520. }
  3521. let htmlMarker = new HTMLMarker(lat, lng);
  3522. htmlMarker.setMap(gmap);
  3523. } else {
  3524. // Custom Image Marker
  3525. const markerEl = document.createElement('div');
  3526. markerEl.className = marker.class || 'custom-marker';
  3527. markerEl.style.backgroundImage = `url(${marker.src})`;
  3528. markerEl.style.backgroundSize = 'contain';
  3529. markerEl.style.backgroundRepeat = 'no-repeat';
  3530. markerEl.style.width = marker.width;
  3531. markerEl.style.height = marker.height;
  3532. const image_marker = new google.maps.marker.AdvancedMarkerElement({
  3533. position: {lat: lat, lng: lng},
  3534. map: gmap,
  3535. content: markerEl
  3536. });
  3537. let flag = false;
  3538. if (popup.defaultOpen === true) {
  3539. infowindow.open({
  3540. anchor: image_marker,
  3541. map: gmap
  3542. });
  3543. flag = true;
  3544. }
  3545. image_marker.addListener("click", toggleBounce);
  3546. function toggleBounce() {
  3547. if (image_marker.getAnimation() !== null) {
  3548. image_marker.setAnimation(null);
  3549. } else {
  3550. image_marker.setAnimation(google.maps.Animation.BOUNCE);
  3551. }
  3552. if (popup) {
  3553. if (flag === false) {
  3554. infowindow.open({
  3555. anchor: image_marker,
  3556. map: gmap
  3557. });
  3558. flag = true;
  3559. } else {
  3560. infowindow.close();
  3561. flag = false;
  3562. }
  3563. }
  3564. }
  3565. }
  3566. } else {
  3567. // Default Marker
  3568. const marker = new google.maps.marker.AdvancedMarkerElement({
  3569. position: {lat: lat, lng: lng},
  3570. map: gmap
  3571. });
  3572. let flag = false;
  3573. if (popup.defaultOpen === true) {
  3574. infowindow.open({
  3575. anchor: marker,
  3576. map: gmap
  3577. });
  3578. flag = true;
  3579. }
  3580. marker.addListener("click", function () {
  3581. if (popup) {
  3582. if (flag === false) {
  3583. infowindow.open({
  3584. anchor: marker,
  3585. map: gmap
  3586. });
  3587. flag = true;
  3588. } else {
  3589. infowindow.close();
  3590. flag = false;
  3591. }
  3592. }
  3593. });
  3594. }
  3595. });
  3596. }