custom.js 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. (function ($) {
  2. "use strict";
  3. // * It's the best idea to write your own JS in custom.js file. So if you want to write JS with your own use this file */
  4. /* ===================================
  5. 1. On Scroll Sticky
  6. g壺
  7. ======================================= */
  8. $(window).on("scroll", function () {
  9. if ($("header").hasClass("sticky-on")) {
  10. var stickyPlaceHolder = $("#sticky-placeholder"),
  11. menu = $("#navbar-wrap"),
  12. menuH = menu.outerHeight(),
  13. topbarH = $("#topbar-wrap").outerHeight() || 0,
  14. targrtScroll = topbarH,
  15. header = $("header");
  16. if ($(window).scrollTop() > targrtScroll) {
  17. header.addClass("sticky");
  18. stickyPlaceHolder.height(menuH);
  19. } else {
  20. header.removeClass("sticky");
  21. stickyPlaceHolder.height(0);
  22. }
  23. }
  24. });
  25. /* ===================================
  26. 2. Pre Loader
  27. ======================================= */
  28. $(window).on("load", function () {
  29. "use strict";
  30. // Page Preloader
  31. let preloader = $(".loader");
  32. preloader &&
  33. $(".loader").fadeOut("slow", function () {
  34. $(this).remove();
  35. });
  36. });
  37. /* ===================================
  38. 3. Google Map
  39. ======================================= */
  40. $(".map-box").each(function () {
  41. var $this = $(this),
  42. key = $this.data("key"),
  43. lat = $this.data("lat"),
  44. lng = $this.data("lng"),
  45. mrkr = $this.data("mrkr");
  46. $this
  47. .gmap3({
  48. center: [-37.81618, 144.95692],
  49. zoom: 12,
  50. scrollwheel: false,
  51. mapTypeId: google.maps.MapTypeId.ROADMAP,
  52. styles: [
  53. {
  54. featureType: "all",
  55. elementType: "labels.text.fill",
  56. stylers: [
  57. {
  58. saturation: 36,
  59. },
  60. {
  61. color: "#333333",
  62. },
  63. {
  64. lightness: 40,
  65. },
  66. ],
  67. },
  68. {
  69. featureType: "all",
  70. elementType: "labels.text.stroke",
  71. stylers: [
  72. {
  73. visibility: "on",
  74. },
  75. {
  76. color: "#ffffff",
  77. },
  78. {
  79. lightness: 16,
  80. },
  81. ],
  82. },
  83. {
  84. featureType: "all",
  85. elementType: "labels.icon",
  86. stylers: [
  87. {
  88. visibility: "off",
  89. },
  90. ],
  91. },
  92. {
  93. featureType: "administrative",
  94. elementType: "geometry.fill",
  95. stylers: [
  96. {
  97. color: "#fefefe",
  98. },
  99. {
  100. lightness: 20,
  101. },
  102. ],
  103. },
  104. {
  105. featureType: "administrative",
  106. elementType: "geometry.stroke",
  107. stylers: [
  108. {
  109. color: "#fefefe",
  110. },
  111. {
  112. lightness: 17,
  113. },
  114. {
  115. weight: 1.2,
  116. },
  117. ],
  118. },
  119. {
  120. featureType: "administrative.country",
  121. elementType: "geometry.stroke",
  122. stylers: [
  123. {
  124. saturation: "-9",
  125. },
  126. ],
  127. },
  128. {
  129. featureType: "landscape",
  130. elementType: "geometry",
  131. stylers: [
  132. {
  133. color: "#e8e8e8",
  134. },
  135. {
  136. lightness: 20,
  137. },
  138. ],
  139. },
  140. {
  141. featureType: "landscape.natural.landcover",
  142. elementType: "geometry.fill",
  143. stylers: [
  144. {
  145. saturation: "-4",
  146. },
  147. {
  148. color: "#cdcdcd",
  149. },
  150. ],
  151. },
  152. {
  153. featureType: "poi",
  154. elementType: "geometry",
  155. stylers: [
  156. {
  157. color: "#d4f1c9",
  158. },
  159. {
  160. lightness: 21,
  161. },
  162. ],
  163. },
  164. {
  165. featureType: "poi.park",
  166. elementType: "geometry",
  167. stylers: [
  168. {
  169. color: "#d4f1c9",
  170. },
  171. {
  172. lightness: 21,
  173. },
  174. ],
  175. },
  176. {
  177. featureType: "road.highway",
  178. elementType: "geometry.fill",
  179. stylers: [
  180. {
  181. color: "#ffeea4",
  182. },
  183. {
  184. lightness: 60,
  185. },
  186. ],
  187. },
  188. {
  189. featureType: "road.highway",
  190. elementType: "geometry.stroke",
  191. stylers: [
  192. {
  193. color: "#f5d681",
  194. },
  195. {
  196. lightness: 30,
  197. },
  198. {
  199. weight: 1,
  200. },
  201. ],
  202. },
  203. {
  204. featureType: "road.arterial",
  205. elementType: "geometry",
  206. stylers: [
  207. {
  208. color: "#ffffff",
  209. },
  210. {
  211. lightness: 18,
  212. },
  213. ],
  214. },
  215. {
  216. featureType: "road.local",
  217. elementType: "geometry",
  218. stylers: [
  219. {
  220. color: "#ffffff",
  221. },
  222. {
  223. lightness: 16,
  224. },
  225. ],
  226. },
  227. {
  228. featureType: "transit",
  229. elementType: "geometry",
  230. stylers: [
  231. {
  232. color: "#f2f2f2",
  233. },
  234. {
  235. lightness: 19,
  236. },
  237. ],
  238. },
  239. {
  240. featureType: "water",
  241. elementType: "geometry",
  242. stylers: [
  243. {
  244. color: "#aadaff",
  245. },
  246. {
  247. lightness: 17,
  248. },
  249. ],
  250. },
  251. ],
  252. })
  253. .marker(function (map) {
  254. return {
  255. position: map.getCenter(),
  256. icon: mrkr,
  257. };
  258. });
  259. });
  260. /* ===================================
  261. 4. Multi Scroll Vertical Slider
  262. ======================================= */
  263. $(function () {
  264. if ($.fn.multiscroll !== undefined) {
  265. var $crPage = $("#radiustheme-multiscroll");
  266. var $crSs = $(">div>section", $crPage);
  267. $crPage.multiscroll({
  268. verticalCentered: true,
  269. navigation: true,
  270. scrollingSpeed: 700,
  271. keyboardScrolling: true,
  272. loopBottom: true,
  273. loopTop: true,
  274. easing: "easeInQuart",
  275. afterLoad: function (anchorLink, index) {
  276. tw_anim_data_con($("[data-uk-scrollspy],[uk-scrollspy]"));
  277. tw_in(
  278. $crSs.filter(".active").find("[data-uk-scrollspy],[uk-scrollspy]")
  279. );
  280. tw_out(
  281. $crSs
  282. .filter(":not(.active)")
  283. .find("[data-uk-scrollspy],[uk-scrollspy]")
  284. );
  285. },
  286. });
  287. }
  288. });
  289. /* ===================================
  290. 5. Data Background Image
  291. ======================================= */
  292. $("[data-bg-image]").each(function () {
  293. const img = $(this).data("bg-image");
  294. $(this).css({
  295. backgroundImage: `url(${img})`,
  296. });
  297. });
  298. /* ===================================
  299. 6. Main Slider
  300. ======================================= */
  301. function mainSlider() {
  302. var BasicSlider = $(".slider--active");
  303. BasicSlider.on("init", function (e, slick) {
  304. var $firstAnimatingElements = $(".slider__single:first-child").find(
  305. "[data-animation]",
  306. "[data-duration]"
  307. );
  308. doAnimations($firstAnimatingElements);
  309. });
  310. BasicSlider.on(
  311. "beforeChange",
  312. function (e, slick, currentSlide, nextSlide) {
  313. var $animatingElements = $(
  314. '.slider__single[data-slick-index="' + nextSlide + '"]'
  315. ).find("[data-animation]", "[data-duration]");
  316. doAnimations($animatingElements);
  317. }
  318. );
  319. BasicSlider.slick({
  320. autoplay: false,
  321. autoplaySpeed: 10000,
  322. dots: false,
  323. fade: true,
  324. arrows: false,
  325. prevArrow:
  326. '<button type="button" class="slick-prev"><i class="fas fa-arrow-left"></i></button>',
  327. nextArrow:
  328. '<button type="button" class="slick-next"><i class="fas fa-arrow-right"></i></button>',
  329. responsive: [
  330. {
  331. breakpoint: 1024,
  332. settings: {
  333. slidesToShow: 1,
  334. slidesToScroll: 1,
  335. infinite: true,
  336. dots: false,
  337. },
  338. },
  339. {
  340. breakpoint: 991,
  341. settings: {
  342. slidesToShow: 1,
  343. slidesToScroll: 1,
  344. arrows: false,
  345. dots: false,
  346. },
  347. },
  348. {
  349. breakpoint: 767,
  350. settings: {
  351. slidesToShow: 1,
  352. slidesToScroll: 1,
  353. arrows: false,
  354. dots: false,
  355. },
  356. },
  357. ],
  358. });
  359. function doAnimations(elements) {
  360. var animationEndEvents =
  361. "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
  362. elements.each(function () {
  363. var $this = $(this);
  364. var $animationDelay = $this.data("delay");
  365. var $animationDuration = $this.data("duration");
  366. var $animationType = "animated " + $this.data("animation");
  367. $this.css({
  368. "animation-delay": $animationDelay,
  369. "-webkit-animation-delay": $animationDelay,
  370. "animation-duration": $animationDuration,
  371. "-webkit-animation-duration": $animationDuration,
  372. });
  373. $this.addClass($animationType).one(animationEndEvents, function () {
  374. $this.removeClass($animationType);
  375. });
  376. });
  377. }
  378. }
  379. mainSlider();
  380. /* ===================================
  381. 7. Parallax
  382. ======================================= */
  383. $(".parallaxie").parallaxie({
  384. speed: 0.9,
  385. offset: 0,
  386. });
  387. /* ===================================
  388. Mouse Hover Directive
  389. ======================================= */
  390. document
  391. .querySelectorAll(".main-menu__nav ul .list a.animation")
  392. .forEach((elem) => {
  393. elem.onmouseenter = elem.onmouseleave = (e) => {
  394. const tolerance = 10;
  395. const left = 0;
  396. const right = elem.clientWidth;
  397. let x = e.pageX - elem.offsetLeft;
  398. if (x - tolerance < left) x = left;
  399. if (x + tolerance > right) x = right;
  400. elem.style.setProperty("--x", `${x}px`);
  401. };
  402. });
  403. document.querySelectorAll(".services-key__navbar_link").forEach((elem) => {
  404. elem.onmouseenter = elem.onmouseleave = (e) => {
  405. const tolerance = 5;
  406. const left = 0;
  407. const right = elem.clientWidth;
  408. let x = e.pageX - elem.offsetLeft;
  409. if (x - tolerance < left) x = left;
  410. if (x + tolerance > right) x = right;
  411. elem.style.setProperty("--x", `${x}px`);
  412. };
  413. });
  414. $(".btn--common").hover(
  415. function () {
  416. $(this).removeClass("rt-button-animation-out");
  417. },
  418. function () {
  419. $(this).addClass("rt-button-animation-out");
  420. }
  421. );
  422. /* ===================================
  423. 8. Case Studies Carousel Active
  424. ======================================= */
  425. $(".case-active").slick({
  426. dots: true,
  427. arrows: false,
  428. infinite: true,
  429. autoplay: false,
  430. speed: 800,
  431. prevArrow:
  432. '<button type="button" class="slider-prev slider-arrow"><i class="fas fa-angle-left"></i></button>',
  433. nextArrow:
  434. '<button type="button" class="slider-next slider-arrow"><i class="fas fa-angle-right"></i></button>',
  435. slidesToShow: 4,
  436. slidesToScroll: 2,
  437. responsive: [
  438. {
  439. breakpoint: 1465,
  440. settings: {
  441. slidesToShow: 3,
  442. slidesToScroll: 1,
  443. infinite: true,
  444. arrows: false,
  445. },
  446. },
  447. {
  448. breakpoint: 1367,
  449. settings: {
  450. slidesToShow: 3,
  451. slidesToScroll: 1,
  452. infinite: true,
  453. arrows: false,
  454. },
  455. },
  456. {
  457. breakpoint: 1024,
  458. settings: {
  459. slidesToShow: 3,
  460. slidesToScroll: 2,
  461. infinite: true,
  462. arrows: false,
  463. },
  464. },
  465. {
  466. breakpoint: 991,
  467. settings: {
  468. slidesToShow: 2,
  469. slidesToScroll: 1,
  470. },
  471. },
  472. {
  473. breakpoint: 767,
  474. settings: {
  475. slidesToShow: 1,
  476. slidesToScroll: 1,
  477. arrows: false,
  478. },
  479. },
  480. ],
  481. });
  482. /* ===================================
  483. 9. Testimonial Carousel Active
  484. ======================================= */
  485. $(".testi-active").slick({
  486. dots: false,
  487. arrows: false,
  488. infinite: true,
  489. autoplay: true,
  490. speed: 800,
  491. prevArrow:
  492. '<button type="button" class="slider-prev slider-arrow"><i class="fas fa-angle-left"></i></button>',
  493. nextArrow:
  494. '<button type="button" class="slider-next slider-arrow"><i class="fas fa-angle-right"></i></button>',
  495. slidesToShow: 3,
  496. slidesToScroll: 2,
  497. responsive: [
  498. {
  499. breakpoint: 1367,
  500. settings: {
  501. slidesToShow: 3,
  502. slidesToScroll: 1,
  503. infinite: true,
  504. arrows: false,
  505. },
  506. },
  507. {
  508. breakpoint: 1024,
  509. settings: {
  510. slidesToShow: 3,
  511. slidesToScroll: 2,
  512. infinite: true,
  513. arrows: false,
  514. },
  515. },
  516. {
  517. breakpoint: 991,
  518. settings: {
  519. slidesToShow: 2,
  520. slidesToScroll: 1,
  521. },
  522. },
  523. {
  524. breakpoint: 760,
  525. settings: {
  526. slidesToShow: 1,
  527. slidesToScroll: 1,
  528. arrows: false,
  529. },
  530. },
  531. ],
  532. });
  533. /* ===================================
  534. 10 Brand Carousel Active
  535. ======================================= */
  536. $(".brand-active").slick({
  537. dots: false,
  538. arrows: false,
  539. infinite: true,
  540. autoplay: false,
  541. speed: 800,
  542. prevArrow:
  543. '<button type="button" class="slider-prev slider-arrow"><i class="fas fa-angle-left"></i></button>',
  544. nextArrow:
  545. '<button type="button" class="slider-next slider-arrow"><i class="fas fa-angle-right"></i></button>',
  546. slidesToShow: 6,
  547. slidesToScroll: 2,
  548. responsive: [
  549. {
  550. breakpoint: 1367,
  551. settings: {
  552. slidesToShow: 5,
  553. slidesToScroll: 1,
  554. infinite: true,
  555. arrows: false,
  556. },
  557. },
  558. {
  559. breakpoint: 1024,
  560. settings: {
  561. slidesToShow: 4,
  562. slidesToScroll: 2,
  563. infinite: true,
  564. arrows: false,
  565. },
  566. },
  567. {
  568. breakpoint: 991,
  569. settings: {
  570. slidesToShow: 3,
  571. slidesToScroll: 1,
  572. },
  573. },
  574. {
  575. breakpoint: 480,
  576. settings: {
  577. slidesToShow: 2,
  578. slidesToScroll: 1,
  579. arrows: false,
  580. },
  581. },
  582. ],
  583. });
  584. /* ===================================
  585. 10. Review Carousel Active
  586. ======================================= */
  587. $(".review--active").slick({
  588. dots: false,
  589. arrows: true,
  590. infinite: true,
  591. autoplay: true,
  592. speed: 800,
  593. prevArrow:
  594. '<button type="button" class="slider-prev slider-arrow"><i class="flaticon flaticon-previous"></i></button>',
  595. nextArrow:
  596. '<button type="button" class="slider-next slider-arrow"><i class="flaticon flaticon-next"></i></button>',
  597. slidesToShow: 3,
  598. slidesToScroll: 1,
  599. responsive: [
  600. {
  601. breakpoint: 1191,
  602. settings: {
  603. slidesToShow: 3,
  604. slidesToScroll: 1,
  605. infinite: true,
  606. arrows: false,
  607. },
  608. },
  609. {
  610. breakpoint: 1100,
  611. settings: {
  612. slidesToShow: 2,
  613. slidesToScroll: 1,
  614. infinite: true,
  615. arrows: false,
  616. },
  617. },
  618. {
  619. breakpoint: 991,
  620. settings: {
  621. slidesToShow: 2,
  622. slidesToScroll: 1,
  623. arrows: false,
  624. },
  625. },
  626. {
  627. breakpoint: 767,
  628. settings: {
  629. slidesToShow: 1,
  630. slidesToScroll: 1,
  631. arrows: false,
  632. },
  633. },
  634. ],
  635. });
  636. /* ===================================
  637. 12. Review Style Two Carousel Active
  638. ======================================= */
  639. $(".review-agency--active").slick({
  640. dots: true,
  641. arrows: false,
  642. infinite: true,
  643. autoplay: true,
  644. speed: 800,
  645. prevArrow:
  646. '<button type="button" class="slider-prev slider-arrow"><i class="flaticon flaticon-previous"></i></button>',
  647. nextArrow:
  648. '<button type="button" class="slider-next slider-arrow"><i class="flaticon flaticon-next"></i></button>',
  649. slidesToShow: 2,
  650. slidesToScroll: 1,
  651. responsive: [
  652. {
  653. breakpoint: 1191,
  654. settings: {
  655. slidesToShow: 3,
  656. slidesToScroll: 1,
  657. infinite: true,
  658. arrows: false,
  659. },
  660. },
  661. {
  662. breakpoint: 1100,
  663. settings: {
  664. slidesToShow: 2,
  665. slidesToScroll: 1,
  666. infinite: true,
  667. arrows: false,
  668. },
  669. },
  670. {
  671. breakpoint: 991,
  672. settings: {
  673. slidesToShow: 2,
  674. slidesToScroll: 1,
  675. arrows: false,
  676. },
  677. },
  678. {
  679. breakpoint: 480,
  680. settings: {
  681. slidesToShow: 1,
  682. slidesToScroll: 1,
  683. arrows: false,
  684. },
  685. },
  686. ],
  687. });
  688. /* ===================================
  689. 13. Mobile Burger Menu Bar
  690. ======================================= */
  691. $(".sidebarBtn").on("click", function (e) {
  692. e.preventDefault();
  693. if ($(".rt-slide-nav").is(":visible")) {
  694. $(".rt-slide-nav").slideUp();
  695. $("body").removeClass("slidemenuon");
  696. } else {
  697. $(".rt-slide-nav").slideDown();
  698. $("body").addClass("slidemenuon");
  699. }
  700. });
  701. /* ===================================
  702. Mobile Menu Dropdown
  703. ======================================= */
  704. var a = $(".offscreen-navigation .menu");
  705. if (a.length) {
  706. a.children("li").addClass("menu-item-parent");
  707. a.find(".menu-item-has-children > a").on("click", function (e) {
  708. e.preventDefault();
  709. $(this).toggleClass("opened");
  710. var n = $(this).next(".sub-menu"),
  711. s = $(this).closest(".menu-item-parent").find(".sub-menu");
  712. a.find(".sub-menu").not(s).slideUp(250).prev("a").removeClass("opened"),
  713. n.slideToggle(250);
  714. });
  715. a.find(".menu-item:not(.menu-item-has-children) > a").on(
  716. "click",
  717. function (e) {
  718. $(".rt-slide-nav").slideUp();
  719. $("body").removeClass("slidemenuon");
  720. }
  721. );
  722. }
  723. /* ===================================
  724. Just On Sticky
  725. ======================================= */
  726. // $(window).on("scroll", function () {
  727. // var scroll = $(window).scrollTop();
  728. // if (scroll < 103) {
  729. // $(".sticky-header").removeClass("IsSticky animated fadeInDown wow");
  730. // } else {
  731. // $(".sticky-header").addClass("IsSticky animated fadeInDown wow");
  732. // }
  733. // if ($(window).width() < 991) {
  734. // $(".sticky-header").removeClass("IsSticky animated fadeInDown wow");
  735. // }
  736. // });
  737. /* Wow Animation Active
  738. ======================================= */
  739. new WOW().init();
  740. /* ===================================
  741. Hover Tilt Effect
  742. ======================================= */
  743. var tiltBlock = $(".js-tilt");
  744. if (tiltBlock.length) {
  745. $(".js-tilt").tilt({
  746. glare: true,
  747. maxGlare: 0.4,
  748. });
  749. }
  750. /* ===================================
  751. Hover Bubble Effect
  752. ======================================= */
  753. $(".animted-bg-wrap").on("mouseenter", function (e) {
  754. var parentOffset = $(this).offset(),
  755. relX = e.pageX - parentOffset.left,
  756. relY = e.pageY - parentOffset.top;
  757. if ($(this).find(".animted-bg-wrap .animted-bg")) {
  758. $(".animted-bg-wrap .animted-bg").css({
  759. top: relY,
  760. left: relX,
  761. });
  762. }
  763. });
  764. $(".animted-bg-wrap").on("mouseout", function (e) {
  765. var parentOffset = $(this).offset(),
  766. relX = e.pageX - parentOffset.left,
  767. relY = e.pageY - parentOffset.top;
  768. if ($(this).find(".animted-bg-wrap .animted-bg")) {
  769. $(".animted-bg-wrap .animted-bg").css({
  770. top: relY,
  771. left: relX,
  772. });
  773. }
  774. });
  775. /* ===================================
  776. On Scroll Counter Count
  777. ======================================= */
  778. var counterContainer = $(".counter-number");
  779. if (counterContainer.length) {
  780. counterContainer.counterUp({
  781. delay: 50,
  782. time: 5000,
  783. });
  784. }
  785. /* ===================================
  786. Off Canvas
  787. ======================================= */
  788. $("#wrapper").on("click", ".offcanvas-menu-btn", function (e) {
  789. e.preventDefault();
  790. var $this = $(this),
  791. wrapper = $(this).parents("body").find(">#wrapper"),
  792. wrapMask = $("<div />").addClass("offcanvas-mask"),
  793. offCancas = $("#offcanvas-wrap"),
  794. position = offCancas.data("position") || "right";
  795. if ($this.hasClass("menu-status-open")) {
  796. wrapper.addClass("open").append(wrapMask);
  797. $this.removeClass("menu-status-open").addClass("menu-status-close");
  798. offCancas.css({
  799. transform: "translateX(0)",
  800. });
  801. } else {
  802. removeOffcanvas();
  803. }
  804. function removeOffcanvas() {
  805. wrapper.removeClass("open").find("> .offcanvas-mask").remove();
  806. $this.removeClass("menu-status-close").addClass("menu-status-open");
  807. if (position === "right") {
  808. offCancas.css({
  809. transform: "translateX(105%)",
  810. });
  811. } else {
  812. offCancas.css({
  813. transform: "translateX(105%)",
  814. });
  815. }
  816. }
  817. $(".offcanvas-mask, .offcanvas-close").on("click", function () {
  818. removeOffcanvas();
  819. });
  820. return false;
  821. });
  822. /* ===================================
  823. Hover Animation Another
  824. ======================================= */
  825. $(".multi-side-hover").each(function () {
  826. $(this).hoverdir({
  827. hoverDelay: 5,
  828. });
  829. });
  830. /* ===================================
  831. Nice Select for Option
  832. ======================================= */
  833. $("select").niceSelect();
  834. /* ===================================
  835. Page Progress Bottom To Top
  836. ======================================= */
  837. if ($(".progress-wrap").length) {
  838. var progressPath = document.querySelector(".progress-wrap path");
  839. var pathLength = progressPath.getTotalLength();
  840. progressPath.style.transition = progressPath.style.WebkitTransition =
  841. "none";
  842. progressPath.style.strokeDasharray = pathLength + " " + pathLength;
  843. progressPath.style.strokeDashoffset = pathLength;
  844. progressPath.getBoundingClientRect();
  845. progressPath.style.transition = progressPath.style.WebkitTransition =
  846. "stroke-dashoffset 10ms linear";
  847. var updateProgress = function () {
  848. var scroll = $(window).scrollTop();
  849. var height = $(document).height() - $(window).height();
  850. var progress = pathLength - (scroll * pathLength) / height;
  851. progressPath.style.strokeDashoffset = progress;
  852. };
  853. updateProgress();
  854. $(window).scroll(updateProgress);
  855. var offset = 50;
  856. var duration = 550;
  857. jQuery(window).on("scroll", function () {
  858. if (jQuery(this).scrollTop() > offset) {
  859. jQuery(".progress-wrap").addClass("active-progress");
  860. } else {
  861. jQuery(".progress-wrap").removeClass("active-progress");
  862. }
  863. });
  864. jQuery(".progress-wrap").on("click", function (event) {
  865. event.preventDefault();
  866. jQuery("html, body").animate(
  867. {
  868. scrollTop: 0,
  869. },
  870. duration
  871. );
  872. return false;
  873. });
  874. }
  875. /* ===================================
  876. Contact Form Response
  877. ======================================= */
  878. var contactForm = $("#contact-form");
  879. if (contactForm.length) {
  880. contactForm.on("submit", function (e) {
  881. var $this = $(this),
  882. $target = contactForm.find(".form-response");
  883. if (e.isDefaultPrevented()) {
  884. $target.html(
  885. "<div class='alert alert-success'><p>Please select all required field.</p></div>"
  886. );
  887. } else {
  888. $.ajax({
  889. url: "assets/php/mailer.php",
  890. type: "POST",
  891. data: contactForm.serialize(),
  892. beforeSend: function () {
  893. $target.html(
  894. "<div class='alert alert-info'><p>Loading ...</p></div>"
  895. );
  896. },
  897. success: function (text) {
  898. if (text === "success") {
  899. $this[0].reset();
  900. $target.html(
  901. "<div class='alert alert-success'><p>Message has been sent successfully.</p></div>"
  902. );
  903. } else {
  904. $target.html(
  905. "<div class='alert alert-success'><p>" + text + "</p></div>"
  906. );
  907. }
  908. },
  909. });
  910. return false;
  911. }
  912. });
  913. }
  914. let getDivs = document.querySelectorAll(".progress-bar");
  915. getDivs.forEach(function (skillbar) {
  916. let data = skillbar.getAttribute("data-width");
  917. skillbar.style.width = data;
  918. });
  919. // isotop
  920. $(".grid").imagesLoaded(function () {
  921. // init Isotope
  922. let $grid = $(".grid").isotope({
  923. itemSelector: ".grid-item",
  924. percentPosition: true,
  925. transitionDuration: ".6s",
  926. hiddenStyle: {
  927. opacity: 0,
  928. transform: "scale(0.001)",
  929. },
  930. visibleStyle: {
  931. transform: "scale(1)",
  932. opacity: 1,
  933. },
  934. masonry: {
  935. // use outer width of grid-sizer for columnWidth
  936. columnWidth: ".grid-item",
  937. },
  938. });
  939. // filter items on button click
  940. $(".case-menu").on("click", "button", function () {
  941. var filterValue = $(this).attr("data-filter");
  942. $grid.isotope({
  943. filter: filterValue,
  944. });
  945. });
  946. });
  947. //for menu active class
  948. $(".case-menu button").on("click", function (event) {
  949. $(this).siblings(".active").removeClass("active");
  950. $(this).addClass("active");
  951. event.preventDefault();
  952. });
  953. // isotop
  954. $(".case-masonry").imagesLoaded(function () {
  955. // init Isotope
  956. let $grid = $(".case-masonry").isotope({
  957. itemSelector: ".grid-item",
  958. percentPosition: true,
  959. masonry: {
  960. // use outer width of grid-sizer for columnWidth
  961. columnWidth: ".grid-item",
  962. },
  963. });
  964. });
  965. /*-------------------------------------
  966. Jquery Serch Box
  967. -------------------------------------*/
  968. $('a[href="#template-search"]').on("click", function (event) {
  969. event.preventDefault();
  970. var target = $("#template-search");
  971. target.addClass("open");
  972. setTimeout(function () {
  973. target.find("input").focus();
  974. }, 700);
  975. return false;
  976. });
  977. $(
  978. "#template-search, #template-search .close, #template-search .eltdf-hm-lines"
  979. ).on("click keyup", function (event) {
  980. if (
  981. event.target === this ||
  982. event.target.className === "close" ||
  983. event.target.className === "eltdf-hm-lines" ||
  984. event.keyCode === 27
  985. ) {
  986. $(this).removeClass("open");
  987. }
  988. });
  989. // CustomHeader
  990. $(".sticky-header").addClass("sticky-on");
  991. })(jQuery);