Skip to content

Instantly share code, notes, and snippets.

View arielsalminen's full-sized avatar
🌸

Ariel Salminen arielsalminen

🌸
View GitHub Profile
@arielsalminen
arielsalminen / triggerpoints.css
Created May 15, 2011 12:54
Triggerpoints for kiskolabs.com
/* 970px and under */
@media screen and (max-width: 970px) { ... }
/* 840px and under */
@media screen and (max-width: 840px) { ... }
/* 740px and under */
@media screen and (max-width: 740px) { ... }
/* 600px and under */
@media screen and (max-width: 600px) { ... }
/* 480px and under */
@media screen and (max-width: 480px) { ... }
@arielsalminen
arielsalminen / responsive.css
Created May 15, 2011 12:55
Responsive jQuery slideshow
#slideshow {
width: 100%;
position: relative;
}
img {
top: 0;
left: 0;
width: 100%;
max-width: 600px;
@arielsalminen
arielsalminen / vunits.js
Created March 3, 2012 05:43 — forked from LeaVerou/vunits.js
Static polyfill for vw, vh, vm units
/**
* Polyfill for the vw, vh, vm units
* Requires StyleFix from -prefix-free http://leaverou.github.com/prefixfree/
* @author Lea Verou
*/
(function() {
if(!window.StyleFix) {
return;
@arielsalminen
arielsalminen / scale.scss
Created March 22, 2012 08:15 — forked from mrdanadams/scale.scss
scale Sass mixin to convert pixels to EMs
@mixin scale($props, $sizes, $base: 16) {
$values: ();
$sublists: false;
@each $s in $sizes {
/* unwrap lists for values that have multiple list of values such as text-shadow */
@if type-of($s) == list {
$sublists: true;
$vv: ();
@each $ss in $s {
$vv: append($vv, if(type-of($ss) == number, #{$ss / $base}em, $ss));

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@arielsalminen
arielsalminen / _pems.scss
Created March 29, 2012 16:13 — forked from mrdanadams/_pems.scss
PX to EMs conversion in Sass
/* See http://mrdanadams.com/2012/pixel-ems-css-conversion-sass-mixin/ */
/* Default font size in pixels if not overridden. */
$baseFontSize: 16;
/* Convert PX units to EMs.
Ex: margin-right: pem(16);
*/
@function pem($pxval, $base: $baseFontSize) {
@return #{$pxval / $base}em;
@arielsalminen
arielsalminen / centerImagesVertically.js
Created May 8, 2012 09:50
Center Images Vertically in JavaScript
jQuery(function () {
var imageHeight, wrapperHeight, overlap, imageContainer = $(".center_vertically");
function centerImagesVertically() {
imageHeight = imageContainer.find("img").height();
wrapperHeight = imageContainer.height();
overlap = (wrapperHeight - imageHeight) / 2;
imageContainer.find("img").css("margin-top", overlap);
}
@arielsalminen
arielsalminen / scrollToTop.js
Created May 8, 2012 09:57
Scroll back to top
jQuery(function () {
var $scrollEl = $("body,html"),
$backtoTop = $(".back_top");
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 600) {
$backtoTop.fadeIn();
} else {
@arielsalminen
arielsalminen / endlessPagination.js
Created May 8, 2012 10:08
Custom endless pagination for isotope (supports query strings in url and updates the page count after each load)
jQuery(function () {
var $feed = $(".feed"),
$trigger = $(".next_page"),
$spinner = $(".spinner"),
spinner = "<div class=\"spinner\"></div>";
var isotopeSettings = {
itemSelector: ".box"
}
@arielsalminen
arielsalminen / dropdown.js
Created May 8, 2012 10:21
Simple drop down that opens on hover
jQuery(function () {
var timer = 0,
delay = 350;
$(".dropdown").hover(function () {
clearTimeout(timer);
$(this).addClass("active").find("ul").show();
}, function () {
timer = setTimeout(function () {