Friday, February 27, 2015

Album Preview Animations using CSS3

In this tutorial we will teach you how to create some album preview effects using CSS only. No JavaScript section here.


The post Album Preview Animations using CSS3 appeared first on jQuery Rain.




by Admin via jQuery Rain

jQuery Random Fade-in

A jQuery plugin for displaying an item by fade-in at random.


The post jQuery Random Fade-in appeared first on jQuery Rain.




by Admin via jQuery Rain

Terms Tree Grid using jQuery

A grid to display data in tree structure by using angular, bootstrap.


The post Terms Tree Grid using jQuery appeared first on jQuery Rain.




by Admin via jQuery Rain

An 8-Step Checklist for Publishing a WordPress Theme on ThemeForest: Part 2

Introduction to Object.observe

Two-way data binding is now one of the crucial features of client-side applications. Without data binding, a developer has to deal with a lot of logic to manually bind data to the view, whenever there is a change in the model. JavaScript libraries like Knockout, AngularJS, and Ember have support for two-way binding but these libraries use different techniques to to detect changes.


Knockout and Ember use observables. Observables are functions wrapped around the properties of the model objects. These functions are invoked whenever there is a change of the value of the corresponding object or property. Although this approach works well, and detects and notifies all the changes, it takes away the freedom of working with plain JavaScript objects as now we have to deal with functions.


Angular uses dirty checking to detect changes. This approach doesn't pollute the model object. It registers watchers for every object added to the model. All of these watchers are executed whenever Angular’s digest cycle kicks in and if there are any changes to the data. Those changes are processed by the corresponding watchers. The model still remains a plain object, as no wrappers are created around it. But, this technique causes performance degradation as the number of watchers grows.


What is Object.observe?


Object.observe, a.k.a. O.o, is a feature to be added to JavaScript as part of ECMAScript 7 to support object change detection natively in the browser. Although ES7 is not completed yet, this feature is already supported in Blink-based browsers (Chrome and Opera).


BecauseObject.observe will be supported by the browsers natively and it works directly on the object without creating any wrappers around it, the API is both easy to use and a win for performance. If Object.observe is supported by a browser, you can implement two-way binding without the need of an external library. It doesn't mean that all of the existing two-way binding libraries will be of no use once O.o is implemented. We still need them to update UIs efficiently after detecting the changes using O.o. Besides, libraries would internally polyfill the logic of change detection if not all targeted browsers support O.o.


Observing Properties of an Object


Now that you have an idea of what O.o is good for, let’s see it in action.


The observe() method is an asynchronous static method defined on Object. It can be used to look for changes of an object and it accepts three parameters:



  • an object to be observed

  • a callback function to be called when a change is detected

  • an optional array containing types of changes to be watched for


Let’s see an example of using the method. Consider the following snippet:


[js] var person = { name: 'Ravi', country: 'India', gender: 'Male' }; function observeCallback(changes){ console.log(changes); }; Object.observe(person, observeCallback); person.name = 'Rama'; // Updating value person.occupation = 'writer'; // Adding a new property delete person.gender; // Deleting a property [/js]

Continue reading %Introduction to Object.observe%




by Ravi Kiran via SitePoint

Swift from Scratch: Delegation and Properties

On Our Radar: Closures, Copyright and the Best Apps of 2014

Hello and welcome to On Our Radar This Week, where we keep you up to date with the most interesting conversations that are taking place on the SitePoint forums. It's been a busy week, and we've had plenty of great threads covering demystifying closures, details on using photos from other sites, a renewed discussion about whether dependency injection breaks encapsulation, and your best apps of 2014.


Demystifying closures


In JavaScript, closure is a very handy technique that allows a function to retain a reference to variables from its parent scope. It can be confusing though as to how this is achieved, and how to make the best use of it. The discussion on demystifying JavaScript Closures, Callbacks, and IIFE's had a lot of valuable comments, and demonstrated that the manner in which we talk about closures can be confusing. Click through to join the discussion.

Using photos from other sites


Web development can be an image-heavy process, so the discussion around using photos from other sites has really taken off and helped people to understand issues around copyright. There are lots of stock photo sites that allow you to buy the rights to use certain images, and a Google Image Search even has a usage-rights selection so that you can search for images that you're allowed to use. One of the fundamental ideas that came up in the thread is that you're free to use photos that you've taken yourself, but when it comes to photos that other people have taken, you need to discover the license that's on the photo. Once you've done that and the license allows you to use it, or you've paid for the right to use the photo, it's all on from there. Click through to join the discussion. Click here to check out the discussion and join in yourself.

Dependency injection breaks encapsulation


A long-running and at times controversial discussion on dependency injection has renewed, with the aim of having a civilized discussion about whether dependency injection breaks encapsulation, and if there are times that dependency injection (DI) may not be useful.

Continue reading %On Our Radar: Closures, Copyright and the Best Apps of 2014%




by Paul Wilkins via SitePoint