Skip to content

Instantly share code, notes, and snippets.

View mistakster's full-sized avatar

Vladimir Kuznetsov mistakster

View GitHub Profile
@mistakster
mistakster / gist:4193053
Last active October 13, 2015 12:07
onAvailable: Executes the supplied callback when the item with the supplied id is found.
(function (window, document) {
function onLoad(callback) {
if (document.readyState === "complete") {
setTimeout(callback, 1);
} else if (document.addEventListener) {
window.addEventListener("load", callback, false);
} else {
window.attachEvent("onload", callback);
}
@mistakster
mistakster / dabblet.css
Created February 28, 2013 02:40
Opera hack
/**
* Opera hack
*/
.body {
background: lightgray;
height: 200px;
}
/* .opera-only - is dummy selector */
.opera-only :-o-prefocus,
.body {
@mistakster
mistakster / dabblet.css
Created March 29, 2013 06:37
Align vertically absolutely positioned element without known height
/**
* Align vertically absolutely positioned element without known height
*/
#has-known-height {
background: lightgray;
height: 300px;
}
#absolutely-positioned {
position: absolute; /* don't touch this property */
background: blue;
@mistakster
mistakster / dabblet.css
Created April 18, 2013 10:00
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
font-size: 11px;
font-family: Arial, sans-serif;
}
.ts {
font-size: 50%;
@mistakster
mistakster / dabblet.css
Created May 27, 2013 03:43
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
font-size: 12px;
font-family: Arial, sans-serif;
}
.ts {
font-size: 50%;
@mistakster
mistakster / dabblet.css
Created May 27, 2013 04:02
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.t {
display: table;
}
.tr {
display: table-row;
}
.td {
@mistakster
mistakster / dabblet.css
Created January 15, 2014 05:37
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html, body {
height: 100%;
padding: 0;
margin: 0;
}
@mistakster
mistakster / init Fotorama with html frames
Last active August 29, 2015 13:56
For the current project, I need Fotorama ( http://fotorama.io/ ) gallery with html frames. Fotrama perfectly handle such situations, but it prevents normal interaction within this frames. I found that I could suppress several events on html frames to bring expected user experience back.
$ele.fotorama()
.find(".fotorama__html")
.on("click mousedown MSPointerDown touchstart", function (e) {
e.preventDefault();
e.stopPropagation();
});
@mistakster
mistakster / environment.js
Created May 5, 2014 08:54
Wait for desired environment (mobile or desktop)
var Environment = (function () {
var _mqDesktop, _mqMobile;
function getMobileMediaQuery() {
return _mqMobile || (_mqMobile = window.matchMedia("(max-width: 719px)"));
}
function getDesktopMediaQuery() {
return _mqDesktop || (_mqDesktop = window.matchMedia("(min-width: 720px)"));
@mistakster
mistakster / index.html
Last active August 29, 2015 14:01
Gradient Performance Test
<!DOCTYPE html>
<html>
<head>
<title>Gradient Performance Test</title>
<style>
div {
height: 150px;
width: 1024px;
}