Thursday, January 21, 2016

14 Do’s and Don’ts of Vine Marketing


Vine is a video creation app by Twitter that enables users to create and share short videos spanning up to 6-second. Launched in January 2013, the app became a big rage on social media podium in no time. Vine has a particular liking among businesses as it helps in promoting their brand, products or even office culture on social media camaraderie. For its short content, it is liked by online users who tend to have a shorter attention span.

For online businesses, Vine is a way of telling the audience who they are and what their products is all about. In technical language, we call it “brand management” which is an important facet for any business to position their brand and what could be a better way to do this than Vine marketing.

So, if you are about to start your Vine marketing to compete with your rivals, then it is about time to know these 7 Do’s and Don’t’s:

by Guest Author via Digital Information World

5 jQuery.each() Function Examples

This is quite an extensive overview of the jQuery each() function. This function is one of jQuery's most important and most used functions. In this article we'll find out why and look into its details to see how you can use it.

[author_more]

What is jQuery .each()

jQuery's each() function is used to loop through each element of the target jQuery object. In case you're not really experienced in jQuery, I remind you that a jQuery object is an object that contains one or more DOM elements, and exposes all jQuery functions. It's very useful for multi-element DOM manipulation, looping arbitrary arrays, and object properties. In addition to this function, jQuery provides a helper function with the same name that can be called without having previously selected or created DOM elements. Let's find out more in the next sections.

jQuery's .each() Syntax

Let's see the different modes in action.

The following example selects every div on the web page and outputs the index and the ID of each of them. A possible output is: “div0:header”, “div1:body”, “div2:footer”. This version uses jQuery's each() function as opposed to the utility function.

[code language="javascript"]
// DOM ELEMENTS
$('div').each(function (index, value) {
console.log('div' + index + ':' + $(this).attr('id'));
});
[/code]

The next example shows the use of the utility function. In this case the object to loop over is given as the first argument. In this example I show how to loop over an array:

[code language="javascript"]
// ARRAYS
var arr = [
'one',
'two',
'three',
'four',
'five'
];
$.each(arr, function (index, value) {
console.log(value);

// Will stop running after "three"
return (value !== 'three');
});
// Outputs: one two three
[/code]

In the last example I want to present loops through the properties of an object:

[code language="javascript"]
// OBJECTS
var obj = {
one: 1,
two: 2,
three: 3,
four: 4,
five: 5
};
$.each(obj, function (index, value) {
console.log(value);
});
// Outputs: 1 2 3 4 5
[/code]

It all boils down to provide a proper callback. The callback's context, this, will be equal to the second argument, which is the current value. However, since the context will always be an object, primitive values have to be wrapped. Therefore, strict equality between the value and the context may not be given. The first argument is the current index, which is either a number (for arrays) or string (for objects).

Continue reading %5 jQuery.each() Function Examples%


by Florian Rappl via SitePoint

LobiPanel – Bootstrap Advanced Floating Panels

LobiPanel is a jQuery plugin for advanced Bootstrap panels with extended functionality. Minimizable, maximizable, sortable, draggable, resizable.


by via jQuery-Plugins.net RSS Feed

GraphQL Overview

Imagine you want to bake a cake by following a recipe. You'll need a few ingredients, and a right quantity for each of them. What if you could get a box with all the ingredients your recipe requires, already measured and weighted to match your recipe? It surely would make baking much easier. This is what GraphQL is meant to do, if you imagine the front-end UI as a cake.

In this tutorial we'll write a small GraphQL server to respond to requests from a Todo List app. You can choose among many apps over there but since I'm working at a React project these days, I'll pick React as the front-end framework. However, feel free to choose any other JavaScript framework you're comfortable with.

GraphQL

GraphQL allows us to define a query that provides a common interface between the client and the server for data fetching and manipulations. It deals with a query language that allows the client to describe the data it needs and its shape, which is designed to build client applications by providing an intuitive and flexible syntax.

Continue reading %GraphQL Overview%


by Igor Ribeiro Lima via SitePoint

What’s New in jQuery 3.0 and How to Use It

This article is part of a web development series from Microsoft. Thank you for supporting the partners who make SitePoint possible.

jQuery, the world’s most popular JavaScript library to date, has been a boon for a lot of us web developers out there. From the time of its initial release in 2006 till today, a lot of us web developers have included this wonderful library in our projects to make our life easier. Back in July 2015, jQuery announced the first alpha of jQuery 3.0 – a major release after a long time. Let’s take a look at what’s new in jQuery and how you can use it.

show() and hide()

There’s a major change with how these functions will work. And there’s good reason to do so. With the earlier implementation, hide() would set the display:none and show() would clear it up. But this led to some mess. Let’s look at a couple of examples:

  1. If there’s an implementation of display:inline on an element in another stylesheet when the show() method was trying to set display:block, this would start breaking code.
  2. When we’re working with media queries for responsive web design (RWD), we may change the visibility of elements using display or visibility. This may interfere with show() and hide().

In addition to these, there were many other issues which the jQuery team had to fix to get things working. This led to complex implementation and performance issues, and hence, they moved to a simple model.

Hence, if you set display:none and use show(), slideDown(), fadeIn() or similar methods to display that element, it won’t work. The better way to go about it is to use addClass() and removeClass() to control visibility. Or we can call hide() on the elements during the ready() call.

Quick sample:


<!DOCTYPE HTML>
<html>
        <head>
        <style>
                .invisible{
                        display: none;
                }
                .visible{
                        background-color: deepskyblue;
                        display:block;
                }
        </style>
        <script src="jquery-3.0.0-alpha1.js"></script>
        <script>
                $(document).ready(function(){
                        $("#div1").addClass("invisible");
                        $("#toggle").click(function(){
                                $("#div1").removeClass("visible");
                                $("#div1").addClass("invisible");
                        });
                });
        </script>
        <title>Control Visibility</title>
        </head>
        <body>
                <p>Hello!</p>
                <div id="div1">Can you see this?</div>
                <button id="toggle">Click me</button>
        </body> 
</html>

Control visibility

Control visibility

Nomenclature for .data() Key Names

The jQuery team changed the .data() implementation to closely match the HTML5 dataset specification. If the key in the data-* attribute contains a digit, the digits will no longer participate in the conversion. Consider this example:

With jQuery 2.1.4:

data attribute in jQuery 2.1.4

The console window does not display the object.

With jQuery 3.0.0:

data attribute in jQuery 3.0.0

The key is converted to foo-42-name as digits do not participate in the conversion to camel case now. Hence, we get the output in console. The fiddle is available at http://ift.tt/1ZPqlSK. You can change the jQuery versions to see the changes.

Similarly, if we want to display all the data using data() with no arguments, the number of arguments will change in the two versions of jQuery if any of the key names of data-* attributes had a digit immediately after the hyphen (-), like in the above case.

width() and height() return decimal values

Some browsers return subpixel values for width and height. jQuery now returns decimal values for .width(), .height(), .css(“width”), and .css(“height”) whenever the browser supports it. For users looking for subpixel precision for designing webpages, this may serve as good news.

.load(), .unload(), and .error() methods are removed

These methods which were deprecated earlier, have now been removed from in jQuery 3.0.0 alpha. The recommended way is to use .on() to handle these events. Short example:

HTML:


<img src="space-needle.png" alt="Space Needle" id="spacen">

JavaScript:

Earlier implementation (now defunct)


$( "#spacen" ).load(function() {
  // Handler implementation
});

Recommended implementation:


$( "#spacen" ).on( "load", function() {
        // Handler implementation
});

jQuery Objects are Iterable Now

Iterating over jQuery objects is possible now, using ES2015 for-of. So, you can use things like:


for ( node of $( "<div id=spacen>" ) ) {
        console.log( node.id ); // Returns ‘spacen’
}

(Source here)

jQuery Animations Now Use requestAnimationFrame API at the Backend

All modern browsers now support requestAnimationFrame (status here: http://ift.tt/1JZDBZo). With its popular support, jQuery will use this API when performing animations. Advantages include smoother animations and less CPU-intensive animations (hence, saving battery on mobiles).

Continue reading %What’s New in jQuery 3.0 and How to Use It%


by Saurabh Kirtani via SitePoint

An Interesting Day

opl-small

One Pager recapping what went down at 'An Interesting Day' - an event held by the team behind Bakken & Bæck.

by Rob Hope via One Page Love

WordPress Plugin Updates the Right Way

Some weeks ago, I received an email about WP Photo Sphere, a WordPress plugin I developed. There was a big problem: updating the plugin broke it on some installations. After some investigation, I discovered that the problem came from the options used by the plugin: these installations hadn’t any default values for the new options I added.

WordPress Plugin Updates

These values were important, so I needed a way to create the default values. But, contrary to what I thought, WordPress doesn’t provide any native way to handle an update process.

That’s why I thought of writing this tutorial. First, we'll see exactly why we need an update process and why WordPress doesn’t provide such a process. Then I’ll show you how to properly create your own process to update your options.

Continue reading %WordPress Plugin Updates the Right Way%


by Jérémy Heleine via SitePoint