main.js 175 KB

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