Skip to content

Instantly share code, notes, and snippets.

@jamielovelace
jamielovelace / akero-form-css.md
Last active September 25, 2018 10:58
akero form css

The form is wrapped in an akHTMLForm class to prevent site styles interfering with form styles so each rule will need to be prepended with a stacked class of .akHTMLForm.akHTMLForm to override the original stylesheet

Labels

.akHTMLForm.akHTMLForm label {}

Pre & Post Text

Helper text that appears above and below the input

@jamielovelace
jamielovelace / fiddle.css
Created March 16, 2018 11:51 — forked from anonymous/fiddle.css
HTML table with vertical scroll inside tbody (source: https://jsfiddle.net/hashem/CrSpu/555/)
table.scroll {
/* width: 100%; */ /* Optional */
/* border-collapse: collapse; */
border-spacing: 0;
border: 2px solid black;
}
table.scroll tbody,
table.scroll thead { display: block; }
@jamielovelace
jamielovelace / svgtopng
Created August 8, 2014 09:39
Replace .svg with .png - with modernizr
/*
* Thanks to Todd Motto ( @toddmotto )
* http://toddmotto.com/mastering-svg-use-for-a-retina-web-fallbacks-with-png-script/
*/
if(!Modernizr.svg) {
var imgs = document.getElementsByTagName('img');
var endsWithDotSvg = /.*\.svg$/
var i = 0;
var l = imgs.length;
@jamielovelace
jamielovelace / gist:b71d36d68f45cdd5737f
Created July 21, 2014 09:34 — forked from anonymous/gist:8316258
PHP Form with ajax validation - php fallback
<?php
$mail_sent = false;
$success_msg = 'Thanks for the comment dude!';
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$errors = array();
$name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
@jamielovelace
jamielovelace / gist:c7dee899ad5c7329eea5
Created May 30, 2014 12:02
Scroll to top - with easing (native javascript)
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@jamielovelace
jamielovelace / gist:ffb578537f96b3e3c7be
Created May 13, 2014 16:29
Basic HTML5 Video - Need to add, seek etc
function hasClass(ele,cls) {
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
if (hasClass(ele,cls)) {
@jamielovelace
jamielovelace / gist:4f630f1195c274b9df3d
Created May 13, 2014 10:32
Vanilla JS - Add Class / Remove Class / Has Class
function hasClass(ele,cls) {
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
if (hasClass(ele,cls)) {