Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / selectivzr_redraw.htm
Last active December 16, 2015 09:29
Redraw selectivzr.js e.g. after loading content via AJAX
<html class="ie8">
<head>
<!--[if (gte IE 6)&(lte IE 8)]>
<script src="js/libs/selectivizr.min.js" type="text/javascript" id="selectivizr"></script>
<![endif]-->
</head>
<body>
</body>
@ingowennemaring
ingowennemaring / placeholder.js
Last active December 16, 2015 09:29
Polyfill for missing placeholder feature in IE <= 9
/*
Placeholder für MSIE/Opera
@param mode => only needed for e.g. responsive sites,
if sometimes placeholders should be shown and sometimes not or the placeholder changed in runtime
mode === 'hide' => add behavior, events and so on, but show no placeholder right now
mode === 'update' => update placeholders which were updated in runtime
*/
var placeholder = function( hidePlaceholder ) {
@ingowennemaring
ingowennemaring / has-js.htm
Created April 18, 2013 14:27
Adds a class to the <html> element if javascript is enabled
<script>document.documentElement.className = (document.documentElement.className !== "") ? "has-js " + document.documentElement.className : "has-js";</script>
@ingowennemaring
ingowennemaring / scrolltoelement.js
Created April 18, 2013 14:19
Scroll to top of an element
$('.goto-element').on(
'click',
function(e) {
e.preventDefault();
var go = $(this).attr('href'),
position = $(go).position();
$('html, body').animate( { scrollTop: position.top } );
}
@ingowennemaring
ingowennemaring / scrolltotop.js
Created April 18, 2013 14:16
Scroll to top of page
$('.goto-top').on(
'click',
function(e){
e.preventDefault();
$('html, body').animate( { scrollTop: 0 } );
}
);
@ingowennemaring
ingowennemaring / rollover_css.css
Last active December 16, 2015 09:28
Image Rollover with CSS, fade effect and image preload
figure {
display: inline-block;
position: relative;
margin: 0;
padding: 0;
img {
display: block;
&:last-child {
@ingowennemaring
ingowennemaring / rollover_fade.htm
Last active December 16, 2015 09:19
Image rollover with preload and fade effect
<a href="#">
<img src="http://dummyimage.com/254x403/ccc/000.jpg&amp;text=254x403+-+Produkt" data-hover="http://dummyimage.com/254x403/999/000.jpg&amp;text=254x403+-+Produkt" alt="" />
</a>