Blame view

frontend/web/js/no-comprss/forms-nocompress.js 2.42 KB
ce681848   Administrator   firs page
1
2
  $(document).ready(function(){
      if($('.blog-buttons-add-favorite, .performance-vacancy-add-favorite a, .get-list, .main-menu-icons-copy, .blog-buttons-offer, .get-project, .main-menu-icons-home').length>0) {
3ba6b877   Administrator   firs page
3
         console.log('here');
067781e2   Administrator   firs page
4
          var overlayLength = $('#overlay').length;
9fcd18ef   Administrator   firs page
5
          $.post("site/forms-modal", function (data) {
ce681848   Administrator   firs page
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
              if ( !overlayLength>0 ){
                  $("body").append('<div id="overlay"></div>');
              }
              $("body").append(data);
          }).complete(function() {
              $('.closed-form, #overlay').on('click', function(){
                  $('#modal_form_favorite, #modal_form_offer, #modal_form_question')
                      .animate({opacity: 0, top: '30%'}, 200,
                      function(){
                          $(this).css('display', 'none');
                          $('#overlay').fadeOut(400);
                      }
                  );
              });
          });
      }
  
      addToFavorites();
      addToOffer();
      addCuestions();
  
      function addToFavorites(){
          $('.blog-buttons-add-favorite, .performance-vacancy-add-favorite a, .get-list, .main-menu-icons-copy').click(function(e){
              var newMarg = $(window).scrollTop();
              e.preventDefault()
              $('#overlay').fadeIn(400,
                  function(){
                      $('#modal_form_favorite')
                          .css({display:'block', marginTop:-230+newMarg})
                          .animate({opacity: 1, top: '50%'}, 200);
                  });
          })
      }
  
      function addToOffer(){
          $('.blog-buttons-offer, .get-project, .main-menu-icons-home').click(function(e){
              var newMarg = $(window).scrollTop();
              e.preventDefault()
              $('#overlay').fadeIn(400,
                  function(){
                      $('#modal_form_offer')
                          .css({display:'block', marginTop:-313+newMarg})
                          .animate({opacity: 1, top: '50%'}, 200);
                  });
          })
      }
  
      function addCuestions() {
          $('.header-contacts-menu li:last-child').click(function(e){
              var newMarg = $(window).scrollTop();
              e.preventDefault()
              $('#overlay').fadeIn(400,
                  function(){
                      $('#modal_form_question')
                          .css({display:'block', marginTop:-230+newMarg})
                          .animate({opacity: 1, top: '50%'}, 200);
                  });
          })
      }
  });