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

Smart farming (fixed bug) #1825

Open
wants to merge 4 commits 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
108 changes: 25 additions & 83 deletions smart-farming.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ notitle: "true"
<div id="myModal" class="modal">
<div class="modal-content">
<div class="close-button">
<img loading="lazy" class="close" src="/images/close-icon.svg" alt="Close"/>
<img class="close" src="/images/close-icon.svg" alt="Close"/>
</div>
<div class="sub-content">
<div class="title">
Expand All @@ -467,28 +467,25 @@ notitle: "true"
<span>Please fill out the form below and we will get back to you within 1-2 business days.
We are looking forward to hearing from you!</span>
</div>
<!-- Id in the form below is dynamically changing for purposes of GTM -->
<form method="post"
onsubmit="return validateContactForm(this)"
class="gtm_form developmentServicesContactUsForm">
<form id="contact-form" method="post" onsubmit="return validateContactForm(this)" class="gtm_form developmentServicesContactUsForm">
<div class="form-section">
<div class="form-element">
<label for="first-name">
<input id="first-name" class="form-control cdu-form-control" value="" placeholder="Your Name" name="first-name" type="text" size="40" maxlength="50">
<input id="first-name" class="cdu-form-control" value="" placeholder="Your Name" name="first-name" type="text" size="40" maxlength="50">
<p>Name*</p>
</label>
</div>
<div class="form-element">
<label for="email">
<input id="email" class="form-control cdu-form-control" value="" placeholder="Enter Email" name="email" type="email" size="40" maxlength="80">
<input id="email" class="cdu-form-control" value="" placeholder="Enter Email" name="email" type="email" size="40" maxlength="80">
<p>Email Address*</p>
</label>
</div>
</div>
<div class="form-section secondary">
<div class="form-element next">
<label for="subject" class="label-select">
<select class="form-control cdu-form-control" name="subject">
<select class="cdu-form-control" name="subject">
<option value="Custom Development" selected>Custom Development</option>
<option value="Technical Support">Technical Support</option>
<option value="ThingsBoard Products">ThingsBoard Products</option>
Expand All @@ -507,7 +504,7 @@ notitle: "true"
<div class="form-section secondary">
<div class="form-element next">
<label for="msg">
<textarea id="msg" class="form-control cdu-form-control cdu-text-area" value="" placeholder="Enter here..." name="message" type="text" size="40" maxlength="800"></textarea>
<textarea id="msg" class="cdu-form-control cdu-text-area" value="" placeholder="Enter here..." name="message" type="text" size="40" maxlength="800"></textarea>
<p>Your message*</p>
</label>
</div>
Expand All @@ -527,14 +524,13 @@ notitle: "true"
if (event.target == modal) {
modal.style.display = "none";
}
};
}

var span = document.getElementsByClassName("close")[0];

span.onclick = function() {
modal.style.display = "none";
};

}
function onContactUsClick(index) {
handleGTMFormID(index);
modal.style.display = "flex";
Expand All @@ -547,84 +543,26 @@ notitle: "true"
}
}

let cduHeader = document.querySelector(".cdu-services .header");

const headerObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("header-animation");
headerObserver.unobserve(entry.target);
}
})
}, {
threshold: 0.5
});

headerObserver.observe(cduHeader);

const sectionLists = document.querySelectorAll(".section-list");

const sectionListObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("section-list-animation");
sectionListObserver.unobserve(entry.target);
}
})
}, {
threshold: 0.2
});

sectionLists.forEach(sectionList => {
sectionListObserver.observe(sectionList)
});

const baseImages = document.querySelectorAll(".base-image");

const baseImagesObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("base-image-animation");
baseImagesObserver.unobserve(entry.target);
}
})
}, {
threshold: 0.3
});

baseImages.forEach(element => {
baseImagesObserver.observe(element)
});

const secondaryImages = document.querySelectorAll(".secondary-image");

const secondaryImagesObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("secondary-image-animation");
secondaryImagesObserver.unobserve(entry.target);
}
})
}, {
threshold: 0.2
});

secondaryImages.forEach(element => {
secondaryImagesObserver.observe(element)
document.querySelectorAll('.anchor-button').forEach(anchor => {
anchor.addEventListener('click', function (e) {
modal.style.display = "flex";
});
});

jqueryDefer(Owl);

function validateContactForm(form) {
var name = $('input[name=first-name]', form).val();
var email = $('input[name=email]', form).val();
var message = $('textarea[name=message]', form).val();

if (!validateValue('Name', name)) {
return false;
}
if (!validateValue('Email Address', email)) {
return false;
}
if (!validateValue('Message', message)) {
return false;
}

var emailExp = /^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
if(email.match(emailExp)==null) {
Expand All @@ -645,6 +583,10 @@ notitle: "true"
return val === undefined || val === null || val.trim().length == 0;
}

var contactform = document.getElementById('contact-form');

contactform.setAttribute('action', 'https://formspree.io/f/xbjvbeln');

jqueryDefer(
function () {
var $contactForm = jQuery('.developmentServicesContactUsForm');
Expand All @@ -653,8 +595,8 @@ notitle: "true"
/* $('html, body').animate({
scrollTop: $('#contact-form').offset().top - 200
}, 0);*/
$contactForm.find('.form-element .form-control').addClass("input--empty");
$contactForm.find('.form-element .form-control').on('input', function() {
$('#contact-form .form-element .form-control').addClass("input--empty");
$('#contact-form .form-element .form-control').on('input', function() {
if( !$(this).val() ) {
$(this).addClass("input--empty");
} else {
Expand All @@ -668,14 +610,13 @@ notitle: "true"
};
var subjectValue = $.urlParam('subject');
if (subjectValue != undefined && subjectValue.trim().length > 0) {
$contactForm.find('select[name=subject]').val(decodeURIComponent(subjectValue));
$contactForm.find('select[name=subject]').removeClass("input--empty");
$('#contact-form select[name=subject]').val(decodeURIComponent(subjectValue));
$('#contact-form select[name=subject]').removeClass("input--empty");
}
});
waitForForm();
}
);

function waitForForm() {
let $form = jQuery('.developmentServicesContactUsForm');
if ($form.length) {
Expand All @@ -689,6 +630,7 @@ notitle: "true"
}
}
</script>

<script type="text/javascript">
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
Expand Down
2 changes: 1 addition & 1 deletion smart-farming.sass
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ $font-style-normal: normal
flex-direction: column
.smart-farm-tech-text
p:nth-child(odd)
margin-bottom: 15px
margin-bottom: 15px
.smart-farm-tech-img
justify-content: center
.img-iot, .img-ai-ml, .img-auto-rob, .img-sensors
Expand Down