Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2015
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.31 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <title>CodePen - Flyaway Send Button</title>
  7.     <link rel="stylesheet" href="http://taskbasket.net/public/css/reset.css">
  8.     <link rel="stylesheet" href="http://taskbasket.net/public/css/style.css" media="screen" type="text/css" />
  9. </head>
  10. <body>
  11.     <form method="post" action="submit.php" id="contactform" class="signin">
  12.         <input name="name" id="name" type="text" class="feedback-input" placeholder="Your Name" />
  13.         <input name="email" id="email" type="text" class="feedback-input" placeholder="Your Email" required pattern="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)" />
  14.         <textarea name="message" id="message" class="feedback-input" placeholder="Your Comment or Question" required></textarea>
  15.         <button id="flybutton">
  16.             <p>CLICK HERE</p>
  17.             <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
  18.                 <path id="paper-plane-icon" d="M462,54.955L355.371,437.187l-135.92-128.842L353.388,167l-179.53,124.074L50,260.973L462,54.955z
  19. M202.992,332.528v124.517l58.738-67.927L202.992,332.528z"></path>
  20.             </svg>
  21.         </button>
  22.     </form>
  23.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  24.     <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
  25.     <script>
  26.         var $btn = $('#flybutton');
  27.         $("#contactform").validate({
  28.             submitHandler: function (form) {
  29.                 fly(form);
  30.             }
  31.         });
  32.  
  33.         $btn.on('fliyingEnd', function (e, form) {
  34.             form.submit();
  35.         })
  36.  
  37.         function fly(form){
  38.            
  39.             $btn.toggleClass('clicked');
  40.             $btn.find('p').text(function(i, text) {
  41.                 return text === "Why sent??" ? "Why Sent??" : "Why Sent??";
  42.             });
  43.            
  44.             setTimeout(function () {
  45.                 $btn.trigger('fliyingEnd', [form]);
  46.             }, 1000);
  47.            
  48.         }
  49.     </script>
  50. </body>
  51.  
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement