Skip to content

Instantly share code, notes, and snippets.

// the retina mixin. An example goes: .at2x(img/[email protected], 650px, 150px, top, left, no-repeat, scroll)
// Put the size that the image appears on a non-retina, e.g. if it's a 200px x 200px non-retina, that is the effective size. The @2x 400px x 400px is calculated automatically. The order to type it is width then height.
// A modification of the retina.js less mixin - https://github.com/imulus/retinajs
@highdpi: ~"(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)";
.at2x(@path, @w: auto, @h: auto, @xpos: 0, @ypos: 0, @repeat: no-repeat, @attachment: scroll) {
background-image: url(@path);
background-position: @xpos @ypos;
background-repeat: @repeat;
@julienchazal
julienchazal / less-mixin-vertical-centering
Created April 18, 2014 10:40
Less mixin for vertical centering (unknown height works too :))
// SOURCE : http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/
.vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
@julienchazal
julienchazal / LESS mixin for CSS arrow
Created April 18, 2014 13:29
LESS mixin for CSS arrow
/* ------------------------ */
/* LESS mixin for CSS arrow */
/* ------------------------ */
/* https://github.com/HugoGiraudel/LESS-Mixin-for-CSS-arrows
//Usage
.arrow(size, color, direction, offset, border-size, border-color);
Where
@julienchazal
julienchazal / jQuery-Smooth-Scroll.js
Last active August 29, 2015 14:00
jQuery Smooth Scroll
$('a[href^="#"]').on("click", function(){
var the_id = $(this).attr("href");
$('html, body').animate({
scrollTop:$(the_id).offset().top
}, 'slow');
return false;
});
// si scroll dans un conteneur :
@font-face {
font-family: 'cicle_gorditagordita';
src: url('fonts/Cicle_Gordita-webfont.eot');
src: url('fonts/Cicle_Gordita-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/Cicle_Gordita-webfont.woff') format('woff'),
url('fonts/Cicle_Gordita-webfont.ttf') format('truetype'),
url('fonts/Cicle_Gordita-webfont.svg#cicle_gorditagordita') format('svg');
font-weight: normal;
font-style: normal;
@julienchazal
julienchazal / jagged-rotated-font-fix.css
Created April 30, 2014 13:00
Jagged rotated font fix
/* jagged rotated font fix (filter for FF)*/
-webkit-backface-visibility:hidden;
outline: 1px solid transparent;
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
@julienchazal
julienchazal / modernizr-load-input-placeholder.js
Created May 13, 2014 14:49
Modernizr conditionnal script loading for input placeholders
Modernizr.load({
test: Modernizr.inputtypes && Modernizr.input.placeholder,
nope: 'scripts/polyfills/placeholders.jquery.min.js'
});
@julienchazal
julienchazal / jQueryOneTransitionend.js
Created September 17, 2015 12:17
jQuery one transitionend
$(this).find('.products_list').one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function() {
// your code when the transition has finished
});
@julienchazal
julienchazal / iOs-hack-for-clicking-html-tag.scss
Last active October 7, 2015 15:15
iOs hack for clicking html tag
// iOs hack for clicking html tag or dynamically loaded elements
&.touch {
cursor:pointer;
// prevent android blue highlight on click
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}