background preloader

Interact.js - JavaScript drag and drop, resizing and gestures with inertia and snapping

Interact.js - JavaScript drag and drop, resizing and gestures with inertia and snapping
Related:  LibsLibrariesAdornments

Core.js A simple, lightweight, base layer to your client-side JavaScript app Core.js allows you to create apps that have multiple working extensions that all interact with each other without ever actually knowing about one another. You can remove any extension without another extension breaking or your browser ever throwing an error. Quick Start Examples Extensions Here's an example of creating an extension and then loading it. Core.extend('extension',function(m){ alert(m); }); Core.load('extension','Hello World'); Push Events Here's an example of how to send a push and another item to receive it (uses jQuery just for example's sake): var i = 0; $(window).click(function(){ Core.push('updateCount',i++); }); Core.listen('updateCount',function(value){ $('.counter').empty().append(i); }); Core.extend(name, onload, onunload) Core.extend() creates a new extension but doesn't actually run any code until Core.load() is called. Example: Core.load(name, options, location) Core.unload(name) Core.unload('extension');

Animo. A powerful little tool for managing transitions and animations with JavaScript. Pure CSS3 Post Tags This is a rather simple pure CSS trick you can use to style your blog post tags, usually placed at the bottom of the posts. Pure CSS post tags uses at least 2 CSS tricks such as CSS triangles and CSS circles. Take a look at the demo For CSS triangles you need to manipulate borders of an element that has zero height and width. CSS circle is simpler. I usually markup tags with unordered list. <ul class="tags"><li><a href="#">tag</a></li><li><a href="#">tag name</a></li></ul> I will add :before and :after pseudo elements and style them to achieve the styling I wanted I am placing the tags list at the bottom of the post element with adjusting ULs absolute position Height (and line-height) of the list item LI and anchor A is set. Next to style is the anchor element. To achieve the pointed edge we are adding a :before pseudo-element. The last element to add is the :after pseudo-element. We’re also adding a :hover state for the anchor: That is it! Enjoyed the article?

interact.js API Documentation interact.js is a JavaScript module for drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE8+). To get a quick overview of how interact.js is intended to be used, read this post on Mozilla Hacks. For a reference of all methods, go to Download $ bower install interact $ npm install interact.js Either: with Bowerwith npmmanually from After downloading the file, add to your page’s HTML a <script> tag who’s src attribute points to the file. jsDelivr CDN If you’d prefer to use the jsDelivr CDN instead, simply add a script tag pointing to //cdn.jsdelivr.net/interact.js/VERSION/interact.min.js. Module interact is exposed as a CommonJS module, an AMD module, or a global object depending on what the environment supports. The interact function takes an Element or CSS selector and an optional options object. Selector Contexts <ul id="my-list"><li> item 1 </li><li> item 2 </li><li> item 3 </li></ul>

Lazy.js - v0.3.2 Lazy.js is a functional utility library for JavaScript, similar to Underscore and Lodash, but with a lazy engine under the hood that strives to do as little work as possible while being as flexible as possible. It has no external dependencies, so you can get started right away with: (Note the package is called "lazy.js", with a dot.) Or, if you're using Lazy.js in the browser: Now let's look at what you can do with Lazy.js. Introduction Let's start with an array of objects representing people. var people = getBigArrayOfPeople(); Suppose we're using this array to back some sort of search-as-you-type functionality, where users can search for people by their last names. var results = _.chain(people) .pluck('lastName') .filter(function(name) { return name.startsWith('Smith'); }) .take(5) .value(); This query does a lot of stuff: So if performance and/or efficiency were a concern for you, you would probably not do things that way using Underscore. Well, yeah. That's where Lazy.js comes in! Features

nib - CSS3 extensions for Stylus Nib is a small and powerful library for the Stylus CSS language, providing robust cross-browser CSS3 mixins to make your life as a designer easier. Installation To get started you'll first want to add nib to your package.json file, along with stylus. Once installed you can use Stylus and Nib with your Connect or Express application as shown in the following snippet. From within a .styl file you can then @import nib, or a portion of nib: @import 'nib' @import 'nib/gradients' @import 'nib/buttons' Rather than manually @import-ing nib within your Stylus source you can import it via the JavaScript API as well: return stylus(str) .set('filename', path) .set('compress', true) .use(nib()) .import('nib'); Gradients Nib's gradient support is by far the largest feature it provides, not only is the syntax extremely similar to what you would normally write, it's more forgiving, expands to vendor equivalents, and can even produce a PNG for older browsers with node-canvas. yields: Position mixins yielding:

Creating Fancy Checkmark Icons with Pure CSS3 I was recently working on a personal project where I wanted to implement some cool “checkmark” icons like you see at left to spice up my unordered lists. I could’ve done it quite easily with the list-style-image property, but I was trying to keep my images and http requests to a minimum, so I wanted to figure out another way to do it (plus, the challenge sounded kind of fun). I had just seen Nicolas Gallagher’s awesome pure css social media icons, though, and I thought, “If he can do that, than I could certainly create a simple check icon with just css3″. I did figure it out with some experimenting and testing, and today I’m going to show you how to achieve the same effect. The #1 Rule of CSS3 Coding Before we start on any project, we have to remember the number one rule of CSS3 coding. It must be cross-browser acceptable. These are the two principles that I regard to be the unchangeable law for using CSS3. The Concept The Code Now, onto the fun part. We’re finsished! Some Thoughts

zloirock/core-js · GitHub Pug docs Installation Pug is available via npm: $ npm install pug Overview The general rendering process of Pug is simple. pug.compile() will compile the Pug source code into a JavaScript function that takes a data object (called “locals”) as an argument. The compiled function can be re-used, and called with different sets of data. p #{name}'s Pug source code! Pug also provides the pug.render() family of functions that combine compiling and rendering into one step.

Hovercard - a jQuery plugin with built in Twitter and Facebook cards Hover over the red text to see the hovercard in action: jQuery is a cross-browser JS library designed to simplify the client-side scripting of HTML. It was released in January of 2006 by John Resig is an application developer at Khan Academy. He was a JavaScript tool developer for the Mozilla Corporation. He is also thecreator and lead developer of the jQuery JavaScript library. at BarCamp NYC. jQuery is free, open source software, dual-licensed under the MIT License and GNU General Public License, Version 2.[4] jQuery's syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications. View Source <p>jQuery is a cross-browser JS library designed to simplify the client-side scripting of HTML.

Related: