fix mailchimp forms

This commit is contained in:
G14 2016-06-24 21:04:10 +05:00
parent 609c59bb96
commit 5dd3353df5
5 changed files with 464 additions and 23 deletions

View File

@ -41,7 +41,8 @@ gulp.task('scripts', function() {
'src/libs/jquery/dist/jquery.min.js',
'src/libs/modernizr/modernizr-custom.js',
'src/libs/waypoints/waypoints.min.js',
'src/libs/swiper/js/swiper.min.js'
'src/libs/swiper/js/swiper.min.js',
'src/libs/mailchimp/mc-validate.js'
])
.pipe(plumber())
.pipe(concat('libs.min.js'))

View File

@ -69,12 +69,12 @@
<div class="status-email">
<div class="email">
<div class="mc_embed_signup">
<form action="//status.us13.list-manage.com/subscribe/post?u=d0c1a0be2adff281b52e27a7f&amp;id=09e2d9ae07" method="post" name="mc-embedded-subscribe-form" class="mc-embedded-subscribe-form validate" target="_blank" novalidate>
<form action="//status.us13.list-manage.com/subscribe/post?u=d0c1a0be2adff281b52e27a7f&amp;id=09e2d9ae07" method="post" name="mc-embedded-subscribe-form" id="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div class="mc_embed_signup_scroll">
<div class="mc-field-group">
<input type="email" value="" name="EMAIL" class="required email-input mce-EMAIL" placeholder="Enter your email for updates">
</div>
<div class="mce-responses" class="clear">
<div class="mce-responses clear">
<div class="response mce-error-response" style="display:none"></div>
<div class="response mce-success-response" style="display:none"></div>
</div>
@ -558,14 +558,14 @@
</div>
</div>
<div class="gradient-email">
<div class="email">
<div class="email">
<div class="mc_embed_signup">
<form action="//status.us13.list-manage.com/subscribe/post?u=d0c1a0be2adff281b52e27a7f&amp;id=09e2d9ae07" method="post" name="mc-embedded-subscribe-form" class="mc-embedded-subscribe-form validate" target="_blank" novalidate>
<div class="mc_embed_signup_scroll">
<div class="mc-field-group">
<div class="mc-field-group-2">
<input type="email" value="" name="EMAIL" class="required email-input mce-EMAIL" placeholder="Enter your email for updates">
</div>
<div class="mce-responses" class="clear">
<div class="mce-responses clear">
<div class="response mce-error-response" style="display:none"></div>
<div class="response mce-success-response" style="display:none"></div>
</div>
@ -619,10 +619,6 @@
<script type="text/javascript" src="js/common.js"></script>
<!-- endbuild -->
<script type="text/javascript" src="libs/mailchimp/mc-validate.js"></script>
<script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
</body>
</html>

View File

@ -85,16 +85,7 @@ $(function() {
},100);
}, { offset: '90%' });
//initialize swiper when document ready
// var mySwiper = new Swiper ('.swiper-container', {
// // Optional parameters
// loop: true,
// autoplay: 3000,
// effect: 'fade',
// nextButton: '.swiper-button-next',
// prevButton: '.swiper-button-prev',
// spaceBetween: 30
// });
// Swiper
var swiper1 = new Swiper('.swiper1', {
loop: true,

411
src/js/libs.min.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

View File

@ -147,7 +147,7 @@
try {
err_style = mc_custom_error_style;
} catch(e){
err_style = '.mc_embed_signup input.mce_inline_error { border-color:#6B0505; } .mc_embed_signup div.mce_inline_error { margin: 0 0 1em 0; padding: 5px 10px; background-color:#eef2f5; font-weight: normal; z-index: 1; color:#6B0505; }';
err_style = '.mc_embed_signup input.mce_inline_error { border-color:#6B0505; } .mc_embed_signup div.mce_inline_error { margin: 0 0 1em 0; padding: 5px 10px; background-color:transparent; font-weight: normal; z-index: 1; color:#6B0505; }';
}
var head = document.getElementsByTagName('head')[0];
var style = document.createElement('style');
@ -254,9 +254,15 @@
if (resp.result == "success"){
$('.mce-'+resp.result+'-response').show();
$('.mce-'+resp.result+'-response').html(resp.msg);
$('.mc-embedded-subscribe-form').each(function(){
$('#mc-embedded-subscribe-form').each(function(){
this.reset();
});
$('.mc-embedded-subscribe-form').each(function(){
this.reset();
});
setTimeout(function() {
$('.email').fadeOut();
},5000);
// If the form has errors, display them, inline if possible, or appended to .mce-error-response
} else {
@ -311,7 +317,7 @@
}
}
window.mc.mce_validator = $(".mc-embedded-subscribe-form").validate({
window.mc.mce_validator = $("#mc-embedded-subscribe-form").validate({
// Set error HTML: <div class="mce_inline_error"></div>
errorClass: "mce_inline_error",
@ -343,6 +349,38 @@
}
});
window.mc.mce_validator = $(".mc-embedded-subscribe-form").validate({
// Set error HTML: <div class="mce_inline_error"></div>
errorClass: "mce_inline_error",
errorElement: "div",
// Validate fields on keyup, focusout and blur.
onkeyup: false,
onfocusout: function(element) {
if (!mc.isTooEarly(element)) {
$(element).valid();
}
},
onblur: function(element) {
if (!mc.isTooEarly(element)) {
$(element).valid();
}
},
// Grouping fields makes jQuery Validation display one error for all the fields in the group
// It doesn't have anything to do with how the fields are validated (together or separately),
// it's strictly for visual display of errors
groups: mc.getGroups(),
// Place a field's inline error HTML just before the div.mc-field-group closing tag
errorPlacement: function(error, element) {
element.closest('.mc-field-group-2').append(error);
},
// Submit the form via ajax (see: jQuery Form plugin)
submitHandler: function(form) {
$(form).ajaxSubmit(mc.ajaxOptions);
}
});
window.mc.ajaxOptions = {
url: mc.getAjaxSubmitUrl(),
type: 'GET',
@ -366,3 +404,7 @@
});
}(jQuery));
(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));
var $mcj = jQuery.noConflict(true);