Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add email submission api #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 5 additions & 31 deletions src/assets/js/app.js
Original file line number Diff line number Diff line change
@@ -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 :)
Expand All @@ -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");
}
});
27 changes: 27 additions & 0 deletions src/assets/js/form.js
Original file line number Diff line number Diff line change
@@ -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');
});
};
27 changes: 27 additions & 0 deletions src/assets/js/scroll.js
Original file line number Diff line number Diff line change
@@ -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');
}
});
});
5 changes: 4 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,21 +324,24 @@ <h3 class="section__title">আমাদের সাথে যোগাযোগ
<form action="#" class="contact__form form">
<input
type="text"
name="name"
class="contact__name form-control"
placeholder="আপনার নাম "
/>
<input
type="email"
name="email"
class="contact__email form-control"
placeholder="আপনার ইমেইল"
/>
<input
type="text"
name="subject"
class="contact__sub form-control"
placeholder="বিষয়"
/>
<textarea
name="text"
name="message"
id="contact__text"
cols="30"
rows="10"
Expand Down
14 changes: 8 additions & 6 deletions src/script.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import "jquery/dist/jquery.slim";
import "popper.js/dist/popper";
import "bootstrap/dist/js/bootstrap.bundle";
import "bootstrap/dist/css/bootstrap.css";
import "./assets/js/app";
import 'jquery/dist/jquery.slim';
import 'popper.js/dist/popper';
import 'bootstrap/dist/js/bootstrap.bundle';
import 'bootstrap/dist/css/bootstrap.css';

import "./assets/sass/main.scss";
import './assets/sass/main.scss';
import './assets/js/app';
import './assets/js/scroll';
import './assets/js/form';