diff --git a/src/assets/js/app.js b/src/assets/js/app.js index 1d22379..d999100 100644 --- a/src/assets/js/app.js +++ b/src/assets/js/app.js @@ -1,22 +1,10 @@ -import $ from "jquery"; +import $ from 'jquery'; $(document).ready(function () { // Active Class Changing for Menu - $(".menu__link").on("click", function () { - $(".menu__link.active").removeClass("active"); - $(this).addClass("active"); - }); - - - // scroll_to_top button event - $(".scroll__top").on("click", (e) => { - e.preventDefault(); - $("html").animate( - { - scrollTop: 0, - }, - 1000 - ); + $('.menu__link').on('click', function () { + $('.menu__link.active').removeClass('active'); + $(this).addClass('active'); }); // FUNNY:- Message for Developers who open Dev-Tools on out site :) @@ -29,21 +17,7 @@ $(document).ready(function () { font-size: 20px; `; console.log( - "%c 🔥 Welcome Developers, If you find any bugs, feel free to knock us anytime.🔥", + '%c 🔥 Welcome Developers, If you find any bugs, feel free to knock us anytime.🔥', styles ); }); - -// window_scroll_function -$(window).scroll(function () { - // [Sticky Header] - let scroll = $(window).scrollTop(); - const header = document.querySelector(".header"); - if (scroll > 500) { - // Custom CSS written and that's will trigger while hovering after scroll - header.classList.add("fixed"); - header.setAttribute("id", "header__sticky"); - } else { - header.removeAttribute("id"); - } -}); diff --git a/src/assets/js/form.js b/src/assets/js/form.js new file mode 100644 index 0000000..2558751 --- /dev/null +++ b/src/assets/js/form.js @@ -0,0 +1,27 @@ +import $ from 'jquery'; + +/** + * Form submission + */ + +const formElm = document.querySelector('form'); +formElm.onsubmit = (e) => { + e.preventDefault(); + const data = Object.fromEntries(Array.from(new FormData(formElm))); + + $.post('https://nnxirtzjgqauhzo.form.io/contactus/submission', { + data: { + yourName: data.name, + email1: data.email, + subject: data.subject, + message1: data.message, + }, + }) + .done(function () { + alert('Your message have been submitted'); + formElm.reset(); + }) + .fail(function () { + alert('There was an error with your submission'); + }); +}; diff --git a/src/assets/js/scroll.js b/src/assets/js/scroll.js new file mode 100644 index 0000000..dbdeff1 --- /dev/null +++ b/src/assets/js/scroll.js @@ -0,0 +1,27 @@ +import $ from 'jquery'; + +$(document).ready(function () { + // scroll_to_top button event + $('.scroll__top').on('click', (e) => { + e.preventDefault(); + $('html').animate( + { + scrollTop: 0, + }, + 1000 + ); + }); + // window_scroll_function + $(window).scroll(function () { + // [Sticky Header] + let scroll = $(window).scrollTop(); + const header = document.querySelector('.header'); + if (scroll > 500) { + // Custom CSS written and that's will trigger while hovering after scroll + header.classList.add('fixed'); + header.setAttribute('id', 'header__sticky'); + } else { + header.removeAttribute('id'); + } + }); +}); diff --git a/src/index.html b/src/index.html index 090d5a8..fc06276 100644 --- a/src/index.html +++ b/src/index.html @@ -324,21 +324,24 @@

আমাদের সাথে যোগাযোগ