Category Archives: JQuery

jQuery Write less do More

Advantages of jQuery Over JavaScript

Advantages of jQuery Over JavaScript

Both JavaScript and jQuery are customer side scripting libraries utilized for undertakings, for example, acceptance, constructing outwardly engaging components like extravagant route menus and so on. Since the motivation behind both the innovations (jQuery and JavaScript) is the same, the decision of utilizing a specific innovation lies with the software engineer. As of late, jQuery is rapidly picking up notoriety over (JavaScript has been around for some a bigger number of years than JQuery). Give us a chance to talk about the conceivable favorable circumstances that jQuery has over JavaScript.

1. jQuery is all around arranged and very much composed

jQuery has a solid group that benefits work in checking and posting modules on the official entrance. Give us a chance to consider for instance that a software engineer wishes to utilize ‘Date Picker’(Date Picker component is utilized to choose a date from a pop up date-book. Once chose, the date quality will be populated in a bordering content box. This spares the writing time for end clients). On the off chance that the software engineer has picked JQuery, he will rapidly download the module from the official site. Then again, if the same software engineer has picked JavaScript, he will be looking on Google for open source JavaScript codes for ‘Date Picker’ component. There would be tens or many results from which he needs to pick one. Most Probably, the code he would be utilizing would not have been checked. Thus it turns out to be clear that jQuery is surely very much sorted out and all around aggregated. Reliable arrangements are conceivable with jQuery which may not be conceivable with JavaScript a large portion of the times.

2. jQuery requires minimum testing exertion

Before being made accessible to developers, jQuery parts are tried on every single prominent program like Mozilla Firefox, Internet Explorer, Google Chrome and so forth. Subsequently the developers need not test a part on all programs. Developers appreciate the recreation of testing on any of the programs. However with JavaScript, there is no surety that the part will have a striking resemblance path in all programs. Subsequently the developers utilizing JavaScript need to perform broad testing on all programs. The testing could be a dull exertion when the quantity of JavaScript parts utilized is high.

3. jQuery requires less troubleshooting exertion

jQuery capacities are secluded and all that much decipherable. They are more succinct than JavaScript. Being secluded and succinct makes the investigating of jQuery code a mess simpler than that of JavaScript.

4. jQuery is redesigned always

jQuery libraries are redesigned always. At whatever point web advances and programs develop, there dependably had been similarity issues with JavaScript libraries. However, this is not the situation with JQuery. jQuery libraries are upgraded always to adjust to new changes in web advances that collaborate with customer side scripts.

CSS Mania jQuery Plugin

Creating Your First JQuery Plugin

 JQuery Plugin

Why Create a jQuery plugin

Sometimes its is useful to have a piece of functionality available throughout your code. Maybe you want a single function you can call on a jQuery selector that performs a specific action on such selector. Or maybe you wrote a utility function in one of your projects and now you want to be able to move it easily to other projects. In any case writing a plugin is your best option.

jQueryis great. It’s cross-browser, easy to learn, and helps you make very user-friendly interfaces. It also comes with a lot of useful plugins to do almost whatever you want.

JQuery Plugin

But sometimes a lot is not enough, what if you can’t find just the right plugin to suit your needs? Or maybe there exist a plugin but its too large, and you just want part of it. The solution might be to roll up your selves and write your own stuff. After all it sound more complicated than it really is. This short tutorial will go through the process of writing a simple plugin, adding some options, and even perform a callback.

Setting Up

You can download the entire project from GitHub

For this tutorial, we will be creating a simple accordion plugin. Let’s create a js file and put it in the “js” directory of our website. It’s tradition to start all js plugin’s files with “jquery dot” followed by the actual plugin name, so we’ll call ours “jquery.simple-accordion.js”.

JQuery Plugin

- Our plugin file inside the js directory inside our website directory

Now we need to include our plugin file along with the jQuery library to our main HTML page (index.html). It is best practice to include the jQuery library directly from the Google api servers, since they are distributed across the world instead of your single server location: Closer servers usually means faster response times for the visitor. Another advantage of having jQuery included from Google, is that when a visitor comes to your site they may already have the jQuery script in their local cache. Pre-cached content usually means faster load times for the visitor.

The jQuery Plugin Structure

jQuery is packed with all the necessary hooks to aid you in the development of our plugin. But is good to keep up the JavaScript good practices, so we must make sure everything is kept inside a local scope. Let’s start with the basic shell of a jQuery plugin:

(function($) {

$.fn.simpleAccordion = function() {

//TODO: code for simple accordion plugin

}

}(jQuery));

Let’s quickly go through what’s going on here. By including everything in the (function() {}) self-enclosed JavaScript pattern, we’re making sure that all the variables in our plugin will stay safely outside of the global namespace. We don’t to run into conflicts with any other javascript running in this page, so we must isolate our code as we did above.

The other thing you might notice is that we’re defining our plugin as if jQuery was in it’s “no-conflict” mode. Again, we’re seeking to avoid colliding with other JavaScript on the page, and thus we want to make sure that our plugin isn’t reliant on the default $, which could be used by another library.

Finally, $.fn is jQuery’s way of allowing you to define our plugin, which we’ve named simpleAccordion. With all of our pieces in place, let’s get cooking!

Adding Functionalities to Our Plugin

What is great about jQuery is that it lets you use any selector you want. However, you must keep in mind that our plug-in can be dealing with several different element types. Using the “this” keyword lets our plug-in apply the associated functions by accessing each element in a loop regardless of the element type.

Getting The HTML Part Ready – Structuring The Accordion

Since we are building an accordion we are going to need to HMLT structure for it, so here we go:

Heading 1

Cras dolor elit, porttitor ac diam bibendum, eleifend aliquam erat.

Heading 2

Donec blandit risus nec est tristique interdum.

Heading 3

Fusce sit amet arcu id justo malesuada faucibus.

Heading 4

Aliquam tincidunt lobortis sem at porttitor.

This is a simple accordion structure, defining four titles and their respective content areas. So the idea is that our plugin will turn this HTML code into a functional accordion, where an user can open and collapse different sections.

This is how it should look like for now:

Just to make it look pretty we should add some simple styles. So here we go:

.accordion {

width: 600px;

border: 1px solid #ccc;

border-bottom: none;

}

.accordion dt,.accordion dd {

border-bottom: 1px solid #ccc;

margin: 0px;

}

.accordion dt {

background: rgba(193, 221, 252, 0.24);

cursor: pointer;

padding: 8px 4px;

font-size: 14px;

font-weight: bold;

}

.accordion dd {

padding: 12px 8px;

}

Now our accordion structure should look like this:

The jQuery Part – Time To Make It Do Something!

To add functionality to our plugin we are going to edit the js file and add the following code:

(function($) {

$.fn.simpleAccordion = function(options) {

return this.each(function() {

var dts = $(this).children(‘dt’);

dts.click(accordionClick);

dts.each(reset);

});

function accordionClick() {

$(this).siblings(‘dt’).each(hide);

$(this).next().slideDown(‘fast’);

return false;

}

function hide() {

$(this).next().slideUp(‘fast’);

}

function reset() {

$(this).next().hide();

}

}

})(jQuery);

Quickly let’s go over what this code is doing. First, you need to understand that jQuery is a library that extends the JavaScript language. When creating any jQuery plug-in, you’re essentially extending the jQuery library, which is extending JavaScript. Truly understanding how your plug-in extends the jQuery library requires an understanding of the JavaScript prototype property. Although it is not used directly, the JavaScript prototype property is used behind the scenes through the jQuery property fn, which is a jQuery alias for the native JavaScript prototype property.

So in simpler terms, you extend your plugin from jQuery by using fn.”your-plugin-name”

In addition, we could add options to pass to our plugin. A jQuery plug-in can include defaults and options. Options are arguments that you could pass to your plug-in. Rather than sending several arguments, with a options object you can send multiple properties, which is the standard jQuery practice. When allowing options in your plug-in, it is a best practice to set default options using the defaults object. Like options, defaults are an object literal that should include the properties you are allowing to be passed to your plug-in.

Let’s quickly add some options to our plugin to show how simple this is. We are going to pass an option parameter to open the first section of our accordion when it is first loaded.

(function($) {

$.fn.simpleAccordion = function(options) {

var state = $.extend({}, {open: false}, options);

return this.each(function() {

var dts = $(this).children(‘dt’);

dts.click(accordionClick);

dts.each(reset);

if(state.open)

$(this).children(‘dt:first-child’).next().show();

});

function accordionClick() {

$(this).siblings(‘dt’).each(hide);

$(this).next().slideDown(‘fast’);

return false;

}

function hide() {

$(this).next().slideUp(‘fast’);

}

function reset() {

$(this).next().hide();

}

}

})(jQuery);

If you notice, we are using default value of open:false, so if no option is passed, the plugin will assume that you want your accordion closed when first loaded. When the plug-in receives options, you can rely on the $.extend method to do the actual overriding. What the $.extend method does is that it merges two or more objects.

That’s it!

So there you have it your first jQuery plugin, very simple right. I hope you enjoyed this tutorial, and find it useful. You can download the entire project from GitHub.

About JQuery

About JQuery – The new and improved jQuery

About JQuery

Everything You Need To Know About jQuery

Java is a one  of the most secured programming stages. Ventures that are made in Java take years to get finished, so you can envision how enormous and adaptable they are. In the event that you have utilized the web, then you more likely than not saw a term ‘JavaScript’. On the off chance that yes, then I need to ask that, do you know anything about jQuery? If not, then I might want to let you know that jQuery is a JavaScript library, which is brimming with instruments that are prepared to be utilized – which plainly demonstrates that it is a pre-composed JavaScript, prepared to give something to do in the site pages. Give me a chance to give you a nitty gritty data about the jQuery and what makes it so well known among the IT individuals.

About JQuery

In the event that you need to choose the components in a page, then you can do it effectively by utilizing the jQuery rather any JavaScript  Library. You can without much of a stretch perceive how to make a wrapped set or sets of components in the jQuery. This will permit you to handle numerous components together in the meantime. You will likewise get the chance to see the control of the wrapped arrangement of components, which is finished by changing the appearance, perceivability, style, content and even the HTML coding. I might likewise want to say that the jQuery accompanies a capable and utility capacities that will give you a chance to decide the sort of program the client is utilizing and what sort of abilities it has.

You will locate various utility capacities in the jQuery, which is an incredible component. That is not it, there are a few different components of jQuery also. With regards to visual impacts, there is no other stage superior to the jQuery in light of the fact that it has like-looking wipes, which will wipe a layer of shading over the components and blurs. This will blur away the component and its experience from the perspective of the client. There are numerous things you can do with such sort of impacts. The front end improvement was very inconspicuous until jQuery touched base into the photo. After the initiation of jQuery, the universe of front end advancement was changed for good, jquery sortable

About JQuery

The basic linguistic structure of the jQuery has made the entangled undertakings a thing to appreciate for the designers. This stage has turned into the main decision of the considerable number of designers, in light of the fact that it has improved things for them. Individuals who began utilizing the library probably discovered the rich and intuitive involvement in their undertakings. Beginning the improvement procedure is simple, yet as the site goes to its finish, things begin to end up troublesome. You may not realize that it can take years to completely value the width and profundity of the jQuery library. With no uncertainty in my psyche, I can say that the jQuery library is brimming with components that you may have never found in your life, yet have dependably wished to have.

About JQuery

Thus, you must study this astonishing programming in light of the fact that it can truly turn the fortunes for you. Numerous organizations require experts who know how to compose jQuery, hence, you can expand your shots of landing a decent position, in the event that you know jQuery. There are numerous preparation focuses that give jQuery course, so what you can do is, you can go online and hunt down the top preparing focuses. Each preparation focus has a site, so you can simply experience their site and see what they are great at. You can likewise see the expense structure for every one of the courses on the site. It is essential to keep yourself upgraded with the most recent improvements in the IT field and jQuery is one of them.

Related Link:
jQuery
jQuery Mobile

Social Media Plugins and Websites

Social Media Plugins and Websites

Social Media Plugins and Websites
Social Media Plugins and Websites

Use of Social Media Plugins for WordPress

Digg :  With Digg, you can make either a gliding online networking bar with left or right looking over choices, or sharing catches that consequently populate at the top or base of each of your blog entries.

Social Media Plugins and Websites
Social Media Plugins and Websites

Digg can be utilized with Twitter, Facebook, Buffer, Google+, LinkedIn, Pinterest, Reddit, Tumblr – pretty much any social channels you may utilize. Facebook choices incorporate both Like and Share, and “apathetic stacking” assists you with eliminating burden times for your site, jquery social media plugin 

Flare : The Flare plugin gives you adaptable offer catches, as well as gives you a chance to make and show a Follow Me gadget, so your guests can a single tick take after your online networking channels right from your site. The plugin is perfect with real online networking stages, including Facebook, Twitter, Pinterest, Google+ and the sky is the limit from there. You can redo the catches’ presence, and spot the offer bar at the top or base of posts, or to one side and right of your pages. The left and right choices look down the page with viewers, and auto-cover up when not being use

ShareThis

With extraordinary customization, huge amounts of elements, and more than 120 bolstered online networking stages, ShareThis is one of the famous online networking plugins for WordPress that has been downloaded more than 1.5 million times. In addition, ShareThis has built-in social analytics, a CopyNShare widget that helps you track shares when your content is copied and pasted, and more.

Offer Buttons by AddThis

AddThis Share Buttons let you incorporate with more than 330 social stages and bookmarking destinations, and additionally email sharing. While there isn’t a possibility for a gliding sidebar, the plugin gives you a lot of format decisions – and you can likewise get free investigation when you make an AddThis account.

Social Media Feather

This Icon plugin gives you an adjustable, configurable social bar that flies onto the screen and looks alongside guests. You can likewise handicap drifting and set up static symbols with this plugin. Social Media Feather gives you more than 20 distinctive symbol styles to look over, so you can coordinate the subjects and styles of your site. It likewise underpins numerous gadgets, so you can show different online networking catches independently on your page

Slick Social Sharing Buttons 

In case you’re searching for an online networking plugin for WordPress that is anything but difficult to execute and accompanies a lot of choices, attempt Slick Social Sharing Buttons. This plugin gives you a chance to alter catch sorts, indicate which pages and presents in plain view social sharing on, and look over either a gliding or slide-out offer bar. You can likewise redo area, bearing, skimming rate, liveliness speed and that’s just the beginning. Slick Social Sharing Buttons underpins shortcodes, and gives you a social investigation dashboard to assist youtrack your sharing activity.

Related Links:
Social Media Plugins