main.js 182 KB

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