Easy peasy parallax effect
Forked from Daniel Riemer's Pen Paral & Lax.
A Pen by Charles F. on CodePen.
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
<h1> Smells Like Bakin </h1> |
<snippet> | |
<content><![CDATA[ | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bootstrap, from Twitter</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> |
<script> | |
$(window).resize(function() { | |
var windowWidth = $(window).width(); | |
$('.screen-width').text(windowWidth + 'px'); | |
}); | |
</script> | |
<div id="debug" style="position:fixed;padding:0.3em 0.6em;background:#f1f1f1;font-size:0.6em;bottom:0;left:50%;"> | |
<span class="screen-width">0</span> | |
</div> |
{ | |
"draw_white_space": "all", | |
"enable_tab_scrolling": false, | |
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "grunt/node_modules"], | |
"font_size": 14, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"open_files_in_new_window": false, |
<img sizes="100vw, (min-width: 40em) 80vw" | |
srcset="../examples/images/pic-small.png 400w, ../examples/images/pic-medium.png 800w, ../examples/images/pic-large.png 1200w" alt="Obama with soldiers"> |
Easy peasy parallax effect
Forked from Daniel Riemer's Pen Paral & Lax.
A Pen by Charles F. on CodePen.
$get-path-to-assets : "http://web-design-weekly/images"; | |
body { | |
background: url(#{$get-path-to-assets}/classy_fabric.png) repeat-x fixed 0 0; | |
} |
Converts pixels to EMs with Sass | |
February 26, 2013 — Jake Bresnehan | |
If you like using pixel values but understand that having your fonts set in EMs works better, especially when tackling responsive web design then this little Sass function will become super handy. | |
This function automatically converts pixels to EMs with Sass so that you don’t have to manually calculate them. | |
The function takes two arguments, pixels and context. You can either use the default context and specify only the pixels you want to convert — or you can specify pixels and a custom context for the conversion.::: | |
This is bit better piece, becaus when page loads you already see the width: | |
$( document ).ready(function() { | |
$(‘.screen-width’).text($(window).width() + ‘px’); | |
}); | |
$(window).resize(function() { | |
var windowWidth = $(window).width(); | |
$(‘.screen-width’).text(windowWidth + ‘px’); | |
}); |