Skip to content

Instantly share code, notes, and snippets.

@ingowennemaring
ingowennemaring / loadvideo.htm
Created April 18, 2013 15:35
Load a video later via jQuery (incl. fix for webkit)
<video width="300" height="500" poster="poster.jpg">
<source type="video/mp4" src="" data-src="video.mp4" />
<source type="video/webm" src="" data-src="video.webm" />
</video>
@ingowennemaring
ingowennemaring / getElementsByClassName.js
Created April 18, 2013 15:38
The missing function "getElementsByClassName()"
function getElementsByClassName(class_name) {
var all_obj, ret_obj=new Array(), j=0, teststr;
if(document.all) {
all_obj = document.all;
}
else if(document.getElementsByTagName && !document.all){
all_obj = document.getElementsByTagName("*");
}
@ingowennemaring
ingowennemaring / equalboxes.css
Created April 18, 2013 16:02
Equal height boxes with jQuery
article {
float: left;
width: 200px;
margin-left: 30px;
&:first-child {
margin-left: 0;
}
}
@ingowennemaring
ingowennemaring / _mixins.scss
Last active December 16, 2015 10:19
Mixins & Extends
/* @group Mixins */
@mixin box-sizing($sizing: content-box) {
-webkit-box-sizing: $sizing;
-moz-box-sizing: $sizing;
box-sizing: $sizing;
}
@mixin rotate($rotate: -90deg) {
-webkit-transform: rotate($rotate);
@ingowennemaring
ingowennemaring / _reset.scss
Last active December 16, 2015 10:19
Resetting and normalizing
/* inspired by Boilerplate, Normalize.css and own thinking :-) */
/* @group BASE */
* {
position: relative;
margin: 0;
padding: 0;
//outline: 0 none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
@ingowennemaring
ingowennemaring / config.rb
Last active December 16, 2015 10:29
Typical config.rb for Compass
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "css"
images_dir = "img"
javascripts_dir = "js"
fonts_dir = "fonts"
@ingowennemaring
ingowennemaring / ishomescreen.js
Created April 22, 2013 09:02
Check if website is added to the home screen or opened in mobile safari
if(navigator.standalone === undefined || !!navigator.standalone) {
// if added to home screen do this
} else {
// if opened in mobile safari do this
}
@ingowennemaring
ingowennemaring / getScrollbarWidth
Created July 31, 2013 12:26
Get the width of the scrollbar
function getScrollbarWidth() {
var scrollbarWidth,
scrollDiv = $('<div />')
.css({
width: '100%',
height: '100%',
overflow: 'scroll',
position: 'absolute',
top: '-9999px'
@ingowennemaring
ingowennemaring / supports
Created August 6, 2015 15:46
Check if a browser supports a feature
function supports ( prop ) {
var div = document.createElement( 'div' ),
vendors = 'Khtml Ms O Moz Webkit'.split( ' ' ),
len = vendors.length;
if ( prop in div.style ) {
return true;
}
@ingowennemaring
ingowennemaring / cssAni
Created August 6, 2015 15:54
Trigger css animations via JavaScript
function cssAni ( mode, elem ) {
var show = function () {
// timeout nötig für Fx => sonst kein transition-Event
setTimeout( function () {
elem.addClass( 'transition visible' );
}, 100 );
};