You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.6 KiB
61 lines
1.6 KiB
$(document).ready(function () {
|
|
// var controller = $.superscrollorama({
|
|
// triggerAtCenter: true,
|
|
// //playoutAnimations: true,
|
|
// reverse:false
|
|
// });
|
|
// controller.addTween('#quote-strip',
|
|
// TweenMax.from($('#quote-strip'), .3, {css:{opacity:0}}));
|
|
// controller.addTween('#event-program-strip',
|
|
// TweenMax.from($('#event-program-strip'), .5, {css:{opacity:0}}));
|
|
// controller.addTween('#footer',
|
|
// TweenMax.from($('#footer'), .5, {css:{opacity:0}}));
|
|
$(".modal-dialog .btn").on("click", function(){
|
|
$(this).closest(".modal-content").find("form").submit();
|
|
return false;
|
|
})
|
|
$("form").on("submit", function(e){
|
|
e.preventDefault();
|
|
var $this = $(this),
|
|
url = $this.attr("action"),
|
|
form = $this.serialize(),
|
|
$modalBody = $this.parent(),
|
|
$message = $("<p class='success-message'></p>"),
|
|
$button = $this.closest(".modal-dialog").find(".btn"),
|
|
$loader = $(".loader",$modalBody);
|
|
$error = $(".err-message",$modalBody),
|
|
$required = $(".required",$modalBody);
|
|
$required.each(function(){
|
|
var $this = $(this),
|
|
$input = $this.children("input");
|
|
if($.trim($input.val()) == ''){
|
|
$this.addClass("err");
|
|
}else{
|
|
$this.removeClass("err");
|
|
}
|
|
});
|
|
if($(".err", $modalBody).length > 0){
|
|
$error.show();
|
|
|
|
}else{
|
|
$loader.show();
|
|
$error.hide();
|
|
$.post(
|
|
url,
|
|
form,
|
|
function(data){
|
|
console.log(data);
|
|
|
|
if(data.message.length){
|
|
$this.fadeOut("fast",function(){
|
|
$loader.hide();
|
|
|
|
$message.text(data.message).appendTo($modalBody);
|
|
});
|
|
$button.fadeOut();
|
|
}
|
|
}
|
|
);
|
|
}
|
|
})
|
|
});
|
|
|