main.js 160 KB

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