main.js 177 KB

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