Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>CodePen - Flyaway Send Button</title>
- <link rel="stylesheet" href="http://taskbasket.net/public/css/reset.css">
- <link rel="stylesheet" href="http://taskbasket.net/public/css/style.css" media="screen" type="text/css" />
- </head>
- <body>
- <form method="post" action="submit.php" id="contactform" class="signin">
- <input name="name" id="name" type="text" class="feedback-input" placeholder="Your Name" />
- <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)" />
- <textarea name="message" id="message" class="feedback-input" placeholder="Your Comment or Question" required></textarea>
- <button id="flybutton">
- <p>CLICK HERE</p>
- <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">
- <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
- M202.992,332.528v124.517l58.738-67.927L202.992,332.528z"></path>
- </svg>
- </button>
- </form>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
- <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
- <script>
- var $btn = $('#flybutton');
- $("#contactform").validate({
- submitHandler: function (form) {
- fly(form);
- }
- });
- $btn.on('fliyingEnd', function (e, form) {
- form.submit();
- })
- function fly(form){
- $btn.toggleClass('clicked');
- $btn.find('p').text(function(i, text) {
- return text === "Why sent??" ? "Why Sent??" : "Why Sent??";
- });
- setTimeout(function () {
- $btn.trigger('fliyingEnd', [form]);
- }, 1000);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement