Solved by Flexbox is not framework, but a website that showcases how Flexbox makes many CSS hacks obsolete.
„This site is not another CSS framework. Instead, its purpose is to showcase problems once hard or impossible to solve with CSS alone, now made trivially easy with Flexbox. And with the recent release of Internet Explorer 11 and Safari 6.1, the latest Flexbox spec is now supported in every modern browser.“
I am starting a small list of Material Design resources. If you have anything to share, let me know in the comments.
Pattern Lock is a light weight plugin to simulate the Android Pattern Lock Mechanism. It’s easy to configure and style.
1 2 3 |
var lock = new PatternLock("#patternContainer"); var lock= new PatternLock('#patternHolder',{radius:30,margin:20}); |
Code My UI provides handpicked code snippets, you can use in your own web projects. You can find website design inspiration, plus some code samples.
NavNav provides a ton of CSS, jQuery, and JavaScript responsive navigation examples, demos, and tutorials from all over the web.
Use the CSS font loading API. Not supported in all browsers yet (MDN, W3C). You can call document.fonts to get a FontFaceSet object.
check(fontSpec)
– returns whether all fonts in the given font list have been loaded and are available. The fontSpec
uses the CSS shorthand syntax for fonts.document.fonts.check('bold 16px Roboto'); // true or false
document.fonts.ready
– returns a Promise indicating that font loading and layout operations are done.
1 2 3 4 5 6 7 8 9 10 |
alert('Roboto loaded? ' + document.fonts.check('1em Roboto')); // false document.fonts.ready.then(function () { alert('All fonts in use by visible text have loaded.'); alert('Roboto loaded? ' + document.fonts.check('1em Roboto')); // true }); document.fonts.onloadingdone = function (fontFaceSetEvent) { alert('onloadingdone we have ' + fontFaceSetEvent.fontfaces.length + ' font faces loaded'); }; |
Use Font Face Observer – its a small @font-face
loader and monitor compatible with any web font service. It will monitor when a web font is applied to the page and notify you. It does not limit you in any way in where, when, or how you load your web fonts. Unlike the Web Font Loader Font Face Observer uses scroll events to detect font loads efficiently and with minimum overhead.
1 2 3 4 5 6 7 8 9 |
var font = new FontFaceObserver('My Family', { weight: 400 }); font.load().then(function () { console.log('Font is available'); }, function () { console.log('Font is not available'); }); |
Use jQuery-FontSpy.js, works by checking the change in width of a string.
1 2 3 4 5 6 7 8 9 |
fontSpy('My Icons', { glyphs: '\ue81a\ue82d\ue823', success: function() { //alert("My Icons loaded successfully"); }, failure: function() { //alert("My Icons failed to load"); } }); |
Use Webfont Loader, if loading fonts from Typekit , Fonts.com, Google, Fontdeck or custom location.
This introduces the following events:
loading
– This event is triggered when all fonts have been requested.active
– This event is triggered when the fonts have rendered.inactive
– This event is triggered when the browser does not support linked fonts or if none of the fonts could be loaded.fontloading
– This event is triggered once for each font that’s loaded.fontactive
– This event is triggered once for each font that renders.fontinactive
– This event is triggered if the font can’t be loaded.
1 2 3 4 5 6 7 8 |
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js"></script> <script> WebFont.load({ google: { families: ['Droid Sans', 'Droid Serif'] } }); </script> |
BackgroundCheck automatically switches to a darker or a lighter version of an element depending on the brightness of images behind it.
Pretty amazing and useful, when doing long one-pagers with switching section backgrounds and navigation elements hovering above them.
1 2 3 4 5 6 7 8 9 10 11 |
p.background--light { color: black; } p.background--dark { color: white; } p.background--complex { color: gray; } |
1 2 3 4 5 6 7 8 9 10 |
// Check all elements with a .target class against all images on a page BackgroundCheck.init({ targets: '.target' }); // Specific images BackgroundCheck.init({ targets: '.target', images: '.thumbnails' }); |
Cocycles is a online code search engine for open source code. Source code is being organized by code pieces and what those pieces can actually do.
SPLIT PANES / DOCKER allow you to display multiple areas, either side by side or one on top of each other. Nested layouts are often part of it. By dragging a divider that appears between the areas, the user can specify how much of the total width / height goes to each area.
I have been building a backend interface in the past weeks, that forced me to look into ways to organize the workspace more efficiently . I could code my own splitter, but is not a priority right now and makes no sense to always reinvent the wheel :)
Here some of the options out there…
This uses the jQuery UI draggable component and provides limited options :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$('.splitter').draggable({ axis: 'x', containment: '#content', distance: 0, drag: function(event, ui) { var width = $('#content').width(); $('#content .leftpane').css({ width: ui.position.left + 'px' }); $('#content .rightpane').css({ left: ui.position.left + 1 + 'px', width: (width - ui.position.left + 1) + 'px' }); }, refreshPositions: true, scroll: false }); |