main.js 173 KB

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