om.Form.validate

document.addEventListener(‘om.Form.validate’, function(event) { // …custom validation code here if (validateError) { event.detail.Form.errors.validate.push(‘This is the error message’) } });Continue reading

om.Optin.init

document.addEventListener(‘om.Optin.init’, function(event) { // This event is passed the Campaign object console.log(event.detail.Campaign); // This event is passed the Optin object console.log(event.detail.Optin); } );Continue reading

om.Campaign.changeView

document.addEventListener(‘om.Campaign.changeView’, function(event) { // This event is passed the Campaign object console.log(event.detail.Campaign); } );Continue reading

om.Campaign.afterCleanup

document.addEventListener(‘om.Campaign.afterCleanup’, function(event) { // This event is passed the Campaign object console.log(event.detail.Campaign); } );Continue reading

om.Campaign.cleanup

document.addEventListener(‘om.Campaign.cleanup’, function(event) { // This event is passed the Campaign object console.log(event.detail.Campaign); } );Continue reading

om.Campaign.afterClose

document.addEventListener(‘om.Campaign.afterClose’, function(event) { // This event is passed the Campaign object console.log(event.detail.Campaign); } );Continue reading

Adding a Clear Button to Reset All Fields in Your Form

document.addEventListener(‘DOMContentLoaded’, function() { // Change the form ID to match your WPForms form ID var form = document.getElementById(‘wpforms-form-10’); if (form) { var clearButton = document.createElement(‘button’); clearButton.type = ‘button’; clearButton.innerText = ‘Clear’; clearButton.class = ‘custom-btn’; clearButton.style.marginTop = ’10px’; clearButton.classList.add(‘custom-clear-button’); form.appendChild(clearButton); clearButton.addEventListener(‘click’,…Continue reading

Carousel

function ResCarouselOnInit(){ResCarouselSize(),ResCarouselSlide(),$(document).on(“click”,”.leftRs, .rightRs”,function(){ResCarousel(this)}),$(document).on(“mouseenter”,”.ResHover”,function(){$(this).addClass(“ResHovered”)}),$(document).on(“mouseleave”,”.ResHover”,function(){$(this).removeClass(“ResHovered”)})}function ResCarouselSlide(){$(“.resCarousel”).each(function(){var e=$(this).find(“.rightRs”),t=$(this).attr(“data-interval”);!isNaN(t)&&$(this).addClass(“ResHover”)&&setInterval(function(){!e.parent().hasClass(“ResHovered”)&&ResCarousel(e)},+t)})}function ResCarouselResize(){function e(){console.log(“resize Works”);var e=$(“body”).width();$(“.resCarousel”).each(function(){var t=$(this).attr(“data-value”),s=$(this).find(“.item”).width();$(this).find(“.resCarousel-inner”).scrollLeft(t*s);var a=$(this).attr(“data-items”).split(“,”),i=e>=1200?a[3]:e>=992?a[2]:e>=768?a[1]:a[0];$(this).attr(“data-itm”,i)})}e()}function ResCarouselSize(){var e=performance.now();$(“.resCarousel”).each(function(e){var t=$(this).attr(“data-items”).split(“,”);$(this).addClass(“ResSlid”+e);for(var s=0;4>s;s++)0==s?styleCollector0=”.ResSlid”+e+” .item {width: “+100/t[s]+”%}”:1==s?styleCollector1=”.ResSlid”+e+” .item {width: “+100/t[s]+”%}”:2==s?styleCollector2=”.ResSlid”+e+” .item {width: “+100/t[s]+”%}”:3==s&&(styleCollector3=”.ResSlid”+e+” .item {width: “+100/t[s]+”%}”);$(this).attr(“data-value”,”0″);var a=$(“body”).width(),i=a>=1200?t[3]:a>=992?t[2]:a>=768?t[1]:t[0];$(this).attr(“data-itm”,i);var o=”@media (max-width:767px){“+styleCollector0+”}@media (min-width:768px){“+styleCollector1+”}@media (min-width:992px){“+styleCollector2+”}@media (min-width:1200px){“+styleCollector3+”}”;$(this).find(“style”).remove(),$(this).append(“ “)});var t=performance.now();console.log(“Took”,(t-e).toFixed(4),”milliseconds to Size”)}function ResCarousel(e){var t=$(e).parent(),s=(t.find(“.leftRs”),t.find(“.rightRs”),+t.attr(“data-slide”)),a=t.find(“.resCarousel-inner”),i=+t.attr(“data-speed”),o=+t.attr(“data-load”),r=””,l=””,n=a.find(“.item”).length,d=a.find(“.item”).outerWidth(),u=+t.attr(“data-itm”),c=$(e).hasClass(“leftRs”),f=Math.round(a.scrollLeft()/d);if(i=isNaN(i)?400:i,s=u>s?s:u,c){l=f-s,r=l*d;var m=l+s;0==f?(l=n-s,r=l*d,l=n-u,i=400):s>=m&&(l=r=0)}else{l=f+s,r=l*d;var…Continue reading