Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| /* | |
| * stickyfloat - jQuery plugin for verticaly floating anything in a constrained area | |
| * | |
| * Example: jQuery('#menu').stickyfloat({duration: 400}); | |
| * parameters: | |
| * duration - the duration of the animation | |
| * startOffset - the amount of scroll offset after it the animations kicks in | |
| * offsetY - the offset from the top when the object is animated | |
| * lockBottom - 'true' by default, set to false if you don't want your floating box to stop at parent's bottom | |
| * $Version: 05.16.2009 r1 |
| /** | |
| * Provides requestAnimationFrame in a cross browser way. | |
| * @author paulirish / http://paulirish.com/ | |
| */ | |
| if ( !window.requestAnimationFrame ) { | |
| window.requestAnimationFrame = ( function() { | |
| return window.webkitRequestAnimationFrame || |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>2-column fluid masonry layout without JS plugins</title> | |
| <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> | |
| <style> | |
| body { | |
| text-align: center; | |
| padding: 3% 8%; |
| // 时间倒数吸顶 | |
| $.fn.smartFloat = function() { | |
| var position = function(element) { | |
| var top = element.position().top, pos = element.css("position"); | |
| $(window).scroll(function() { | |
| var scrolls = $(this).scrollTop(); | |
| if (scrolls > top) { | |
| if (window.XMLHttpRequest) { | |
| element.css({ | |
| position: "fixed", |
| (function () { | |
| 'use strict'; | |
| $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { | |
| var id = $(this).parents('[role="tablist"]').attr('id'); | |
| var key = 'lastTag'; | |
| if (id) { | |
| key += ':' + id; | |
| } |
Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets
“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”
You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?
| function add() { | |
| var sum = 0; | |
| function add() { | |
| for (var i=0; i<arguments.length; i++) { | |
| sum += Number(arguments[i]); | |
| } | |
| return add; | |
| } | |
| add.valueOf = function valueOf(){ |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent