Advertisement
artursn

Untitled

Jul 14th, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 6.09 KB | None | 0 0
  1. <style>
  2.         @import url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300,100&subset=latin,cyrillic-ext,cyrillic,latin-ext);
  3.    
  4.         .ad-section {
  5.           font-family: 'Roboto', sans-serif;
  6.         }
  7.  
  8.         div[id^='dynamic_'] {
  9.             display: block !important;
  10.         }
  11.  
  12.         .ad-section:after {
  13.           content: "";
  14.           display: table;
  15.           clear: both;
  16.         }
  17.  
  18.         .media {
  19.           display: table;
  20.           width: 100%;
  21.         }
  22.  
  23.         .media-middle {
  24.           display: table-cell;
  25.           vertical-align: middle;
  26.         }
  27.  
  28.         .media-top {
  29.           display: table-cell;
  30.           vertical-align: top;
  31.         }
  32.  
  33.         .ad-input__wrap {
  34.           background-color: #fff;
  35.           border: 1px solid #a7a7a7;
  36.           margin: 12px 0;
  37.         }
  38.  
  39.         .ad-input__wrap.error {
  40.           border-color: #AC1616;
  41.         }
  42.  
  43.         .ad-textarea, .ad-input {
  44.           display: block;
  45.           width: 100%;
  46.           color: #9b9b9b;
  47.           font-size: 14px;
  48.           padding: 5px 12px 5px;
  49.           border: none;
  50.           outline: none;
  51.           box-sizing: border-box;
  52.         }
  53.  
  54.         .ad-textarea {
  55.           resize: none;
  56.           height: 126px;
  57.         }
  58.  
  59.         .ad-btn {
  60.           display: inline-block;
  61.           background: none;
  62.           border: none;
  63.           font-size: 22px;
  64.           text-align: center;
  65.           padding: 7px 15px 6px;
  66.           text-decoration: none;
  67.           color: #fff;
  68.           -webkit-transition: .2s linear;
  69.           transition: .2s linear;
  70.           cursor: pointer;
  71.           text-transform: uppercase;
  72.         }
  73.  
  74.         .ad-btn__green {
  75.           background-color: #009e71;
  76.         }
  77.  
  78.         .ad-btn__green:hover {
  79.           background-color: #00855f;
  80.         }
  81.  
  82.         .ad-section {
  83.           background-color: #005436;
  84.           color: #fff;
  85.           border-radius: 8px;
  86.           border: 3px solid #e3e3e3;
  87.         }
  88.  
  89.         .ad-form {
  90.           width: 380px;
  91.           padding: 18px 25px 20px;
  92.           box-sizing: border-box;
  93.           float: left;
  94.           background-color: #006846;
  95.           border-radius: 7px 0 0 7px;
  96.         }
  97.  
  98.         .ad-form__text {
  99.           font-size: 15px;
  100.           color: #fff;
  101.           font-weight: 300;
  102.           line-height: 1.15;
  103.         }
  104.  
  105.         .ad-form__send {
  106.           width: 230px;
  107.           margin-top: 14px;
  108.         }
  109.  
  110.         .ad-code__text {
  111.           font-size: 14px;
  112.           margin-bottom: 6px;
  113.         }
  114.  
  115.         .ad-code__l {
  116.           width: 120px;
  117.         }
  118.  
  119.         .ad-code__captcha {
  120.           height: 50px;
  121.         }
  122.  
  123.         .ad-code__captcha img {
  124.           width: 100%;
  125.           height: 100%;
  126.           display: block;
  127.         }
  128.  
  129.         .ad-code__input {
  130.           margin: 0;
  131.         }
  132.  
  133.         .ad-code__reload {
  134.           color: #79d8b9;
  135.           font-size: 12px;
  136.           display: inline-block;
  137.           margin-top: 11px;
  138.         }
  139.  
  140.         .ad-code__reload:hover {
  141.           text-decoration: none;
  142.         }
  143.  
  144.         .ad-code__r {
  145.           padding-left: 10px;
  146.         }
  147.  
  148.         .ad-right {
  149.           text-align: center;
  150.           padding-bottom: 25px;
  151.         }
  152.  
  153.         .ad-logo {
  154.           display: inline-block;
  155.           text-decoration: none;
  156.           margin: 30px 0;
  157.         }
  158.  
  159.         .ad-skype {
  160.           font-size: 21px;
  161.           display: inline-block;
  162.           color: #fff;
  163.           text-decoration: none;
  164.           margin: 7px 0;
  165.         }
  166.  
  167.         .ad-skype:hover {
  168.           text-decoration: underline;
  169.         }
  170.  
  171.         .ad-skype img {
  172.           vertical-align: middle;
  173.           margin-right: 8px;
  174.         }
  175.  
  176.         .ad-thanks {
  177.           display: none;
  178.           font-size: 22px;
  179.           text-align: center;
  180.           margin: 40px 20px 0;
  181.           color: #fff;
  182.           line-height: 1.4;
  183.         }
  184.     </style>
  185.  
  186. </head>
  187. <body>
  188.     <section class="ad-section">
  189.         <form action="https://adbetnet.com/advertise" class="ad-form">
  190.             <p class="ad-form__text">По вопросам размещения рекламы на сайте обращайтесь по указным контактам или заполните форму обратной связи:</p>
  191.  
  192.             <div class="ad-input__wrap">
  193.                 <input type="text" class="ad-input" placeholder="Введите ваше имя*" name="name">
  194.             </div>
  195.  
  196.             <div class="ad-input__wrap">
  197.                 <input type="text" class="ad-input" placeholder="Укажите ваш мейл*" name="email">
  198.             </div>
  199.  
  200.             <div class="ad-input__wrap error">
  201.                 <input type="text" class="ad-input" placeholder="Тема*" name="subject">
  202.             </div>
  203.  
  204.             <div class="ad-input__wrap">
  205.                 <textarea class="ad-textarea" name="textarea"></textarea>
  206.             </div>
  207.             <button class="ad-btn ad-btn__green ad-form__send">Отправить</button>
  208.  
  209.         </form>
  210.  
  211.         <div class="ad-right">
  212.             <div class="ad-right__item">
  213.                 <a href="https://adbetnet.com/" class="ad-logo"><img src="https://cdn.advertserve.com/images/adbetnet.advertserve.com/servlet/files/38539#feedback/logo.png" alt=""></a>
  214.             </div>
  215.             <div class="ad-right__item">
  216.                 <a href="skype:adbetnet?call" class="ad-skype"><img src="https://cdn.advertserve.com/images/adbetnet.advertserve.com/servlet/files/38540#feedback/skype.png" alt=""> adbetnet</a>
  217.             </div>
  218.  
  219.             <div class="ad-thanks">Ваше сообщение отправлено. <br>Спасибо!</div>
  220.         </div>
  221.  
  222.  
  223.     </section>
  224.  
  225.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  226.  
  227.   <script>
  228.         var $thanks = $('.ad-thanks');
  229.  
  230.    $('.ad-form').on('submit', function (e) {
  231.      e.preventDefault();
  232.  
  233.      var $this = $(this),
  234.        formValues = getValues($this),
  235.          action = $this.attr('action'),
  236.          $inputs = $this.find('.ad-input__wrap'),
  237.          sendActive = true;
  238.  
  239.      $inputs.removeClass('error');
  240.  
  241.      $inputs.each(function() {
  242.       var $this = $(this),
  243.         $input = $this.find('input'),
  244.         inputValue = $input.val();
  245.  
  246.       if (inputValue === null || inputValue == '') {
  247.        $this.addClass('error');
  248.        sendActive = false;
  249.       }
  250.      });
  251.  
  252.      if (sendActive) createPost(action, $inputs, $this);
  253.  
  254.    });
  255.    
  256.  
  257.    function createPost(act, val, $form) {
  258.      $.ajax({
  259.       url: act,
  260.       jsonp: "callback",
  261.    
  262.       dataType: "jsonp",
  263.    
  264.       data: val,
  265.    
  266.       success: function( obj ) {
  267.         var parseObj = obj;
  268.  
  269.         if (!parseObj.result) {
  270.           var errors = parseObj.errors;
  271.           for (var key in errors) {
  272.             $form.find('.ad-input[name=' + key + ']').parent().addClass('error');
  273.           }
  274.         } else {
  275.           $thanks.fadeIn();
  276.           $form.hide();
  277.         }
  278.       }
  279.    }).fail(function (jqXHR, textStatus, errorThrown) {
  280.        console.log(textStatus + " | " + errorThrown);
  281.      });
  282.    }
  283.  
  284.    function getValues(form) {
  285.      return form.serialize();
  286.    };
  287.   </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement