For when you want a sticky footer, but can't guarantee the height of the footer.
Modified from https://css-tricks.com/snippets/css/sticky-footer/
<div class="page-wrap js-page-wrap">
| <form> | |
| <input type="text" class="form-control" id="name-input" placeholder="Your name"> | |
| <input type="email" class="form-control" id="email-input" placeholder="Your email"> | |
| <textarea id="message-input" class="form-control" placeholder="What did you want to tell us?"></textarea> | |
| <button type="submit" class="btn btn-default" id="submit-button">Send Message</button> | |
| </form> | |
| <script> | |
| jQuery(document).ready(function($) { |
| if (typeof console === 'undefined') { | |
| console = {}; | |
| console.log = function() { | |
| return; | |
| } | |
| } |
| jQuery(document).ready(function($) { | |
| $(document).on('click', 'a', function(e) { | |
| if (this.href.indexOf('http') !== -1 && this.href.indexOf(location.host) === -1) { | |
| e.preventDefault(); | |
| window.open(this.href, '_blank').focus(); | |
| } | |
| }); | |
| }); |
| jQuery(document).ready(function($) { | |
| var offendingElement = $('.dumb-thing'); | |
| offendingElement.each(function() { | |
| $(this).data('onclick', this.onclick); | |
| this.onclick = function(event) { | |
| if (somethingIsWrong()) { | |
| return false; // don't call the onclick |
| /** | |
| * Is string a valid email address? | |
| * | |
| * @param {string} str | |
| * @return {boolean} | |
| */ | |
| var validEmail = function (str) { | |
| var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; | |
| return re.test(str); | |
| }; |
| /** | |
| * Is string a valid phone number? | |
| * | |
| * @param {string} str | |
| * @return {boolean} | |
| */ | |
| var isValidPhone = function (str) { | |
| if (!str) return false; | |
| var count = str.replace(/[^0-9]/g, '').length; | |
| return count == 10 || count == 11; |
| /** | |
| * Is string a valid zip code? | |
| * | |
| * @param {string} str | |
| * @return {boolean} | |
| */ | |
| var isValidZip = function (str) { | |
| return /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(str); | |
| }; |
| /** | |
| * Get URL param | |
| * | |
| * @param {string} param | |
| * @return {string|null} | |
| */ | |
| var getUrlParam = function (param) { | |
| // if input is invalid or there are no query params, return null | |
| if (typeof param !== 'string' || location.search === '') return null; |