modal.js
2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
$(
function() {
modalForms();
closeForms();
function modalForms() {
$('body').on('click','.modal-link', function (e) {
e.preventDefault();
var idForm = $(this).data('form');
// console.log(idForm);
var pos = ($(window).scrollTop()+30+50);
// console.log(pos);
$('#overlay').fadeIn(400,
function(){
$('#'+idForm)
.css('display', 'block')
.animate({opacity: 1, top: pos}, 200);
});
$("body").addClass("off-scroll");
})
}
function closeForms() {
$('.close, #overlay').click( function(){
$('.forms_').animate({opacity: 0, top: '0'}, 200,function(){
$(this).css('display', 'none');
$('#overlay').fadeOut(400);
});
$('.success_').animate({opacity: 0, top: '0'}, 200,function(){
$(this).css('display', 'none');
$('#overlay').fadeOut(400);
});
$('#success_form').animate({opacity: 0, top: '0'}, 200,function(){
$(this).css('display', 'none');
$(this).css({top:'50%'});
});
$("body").removeClass("off-scroll");
});
}
$(".on_input_").on('click', function(){
$(this).addClass("actived");
$(this).parent().find("input").focus();
});
$(".modal_form input").on('focusout', function(){
$(".on_input_.actived").removeClass("actived");
});
$(".bnm.btn").on('click', function(){
$("#booknow-modal .modal-title").html($(this).data('title'));
$("#booknow-modal #booknow-tour").val($(this).data('title'));
});
$(".success_ button").click(function(){
$(".success_").removeClass("done_");
});
$("#success-modal button.btn.btn-template-primary").click(function(){
$(".close").click();
$('#success_form').animate({opacity: 0, top: '0'}, 200,function(){
$(this).css('display', 'none');
$(this).css({top:'50%'});
});
$('#success-modal').animate({opacity: 0, top: '0'}, 200,function(){
$(this).css('display', 'none');
$(this).css({top:'50%'});
});
});
$(".overlay-new").click(function(){
$(".close").click();
});
}
);