html - jquery for a form not working in FF and android (on a wordpress site) -
so wanted cool styling on contact form 7 form. got worked fine in chrome tested in ff , on phone , didnt work. missing here?
here code. http://codepen.io/baxweb/pen/xbjqex
html
<form name="" action="/quote/#wpcf7-f376-p219-o1" method="post" class="wpcf7-form" novalidate="novalidate"> <div class="input-group"> <span> <input type="text" name="your-name" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false"> </span> <label>your name</label> </div> <div class="input-group"> <span> <input type="email" name="email-379" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" aria-invalid="false"> </span> <label>your email</label> </div> <div class="input-group"> <span class="wpcf7-form-control-wrap tel-135"> <input type="tel" name="tel-135" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-tel wpcf7-validates-as-tel" aria-invalid="false"> </span> <label>telephone</label> </div> <div class="input-group"> <span> <textarea name="your-message" cols="40" rows="10" class="wpcf7-form-control wpcf7-textarea" aria-invalid="false"></textarea> </span> <label>additional thoughts?</label> </div> <p> <input type="submit" value="get quote" class="wpcf7-form-control wpcf7-submit"> </form>
css
.wpcf7-form input, .wpcf7-form textarea { background: none; border: solid 2px #21a1e1; color: #000 !important; padding: 15px 40px; font-size: 18px; display: inline-block; } .wpcf7-form input:focus, .wpcf7-form input:active, .wpcf7-form textarea:focus, .wpcf7-form textarea:active { outline: none; } .wpcf7-form input[type="text"], .wpcf7-form input[type="email"], .wpcf7-form input[type="tel"], .wpcf7-form input[type="date"] { border: none; border-bottom: solid 2px #21a1e1; } .wpcf7-form input[type="submit"] { margin-top: 20px; } .wpcf7-form input[type="submit"]:active { color: white; background: #21a1e1; } .input-group { display: block; margin-top: 25px; position: relative; } .input-group input, .input-group textarea { padding: 15px 0; } .input-group label { position: absolute; top: 50%; left: 5px; -webkit-transform: translatey(-50%); -ms-transform: translatey(-50%); transform: translatey(-50%); font-family: georgia, cambria, "times new roman", times, serif; font-style: italic; font-size: 18px; color: #999; pointer-events: none; -webkit-transition: .15s ease-out 0s; transition: .15s ease-out 0s; } .input-group label.has-value { top: -5px; left: 0; font-size: 12px; color: #aaa; } div.wpcf7 .wpcf7-form-control { max-width: 100%; } .wpcf7-form input[type=text]:focus, .wpcf7-form input.text:focus, .wpcf7-form input.title:focus, .wpcf7-form textarea:focus, .wpcf7-form select:focus { border-color: #21a1e1 !important; color: #21a1e1;
js
$(function(){ $('.input-group input, .input-group textarea').focusin(function(){ $(this).closest('div').find('label').addclass('has-value'); }); $('.input-group input, .input-group textarea').focusout(function(){ var text_val = $(this).val(); if(text_val === "") { $(this).closest('div').find('label').removeclass('has-value'); } }); });
it seems jquery, put jquery in custom.js file theme. divi theme theme forest, if helps.
thanks guys!
Comments
Post a Comment