Category — Javascript

How to dynamically create Twitter’s tweet button and Facebook’s like button!

There are many examples out there in the world of internet, which show how to integrate the tweet button and the like button, but none show how to do it dynamically. In this post I have tried to show how trivial it is to generate tweet and like button dynamically using JavaScript.

November 4, 2010   Views: 50,748   37 Comments

jQuery Spotlight Plugin: jSpotlight

About: This plugin allows you to bring spotlight on any HTML element. This plugin may be used in situations where you need to call attention to or highlight where a data value or content has changed within the interface. A particular usage would be when implementing the UI Pattern “One Second Spotlight”. Do note that jQuery in itself has no highlight effect and the animate function does not support color animation or transition. Hence, this plugin aims at adding that functionality. The color animation is based on jQuery Color Animations by John Resig and the color conversion functions are based…

August 19, 2010   Views: 10,903   16 Comments

Javascript method priority queue

Problem Statement: There are times when people are faced with the problem of calling methods in a particular order based on some kind of priority. There are times when you wish to be able to add methods to some kind of a method queue along with the priority. The priority decides which methods is to be called first. Then at some later point, you wish to execute the methods in the queue in order of priority. A case in point may be when you have multiple document ready handlers which add method calls to the queue, and then on the…

August 14, 2010   Views: 8,165   6 Comments

A useful JavaScript pattern – The Module Pattern

Introduction A good API design forms an integral part of coding best practices. And what is a good API? A good API would only expose methods that would be needed by the client using the API. The public space would not be cluttered by unnecessary methods. And there are not many times where I have seen JavaScript developers really caring about a good API design. The reason probably is that people don’t take JavaScript seriously. Anyway, that is another topic, which might require a separate blog post of its own. Module pattern So coming back to the topic, I would…

July 25, 2010   Views: 6,279   17 Comments

jQuery – Using $ with other JavaScript libraries

Although $ sounds native to jQuery alone, but there are other JavaScript libraries and frameworks as well that use $, one example is scriptaculous. But what if you want to use $ in your jQuery based code or plugin, $ sure is a very short shortcut. I will show you a nice little trick of how to do so. The trick involves writing all the code in a function and executing that function immediately: (function() { // put your code here })(); See how the function gets executed immediately, so all you need to do now to use $, is…

July 6, 2010   Views: 5,126   8 Comments

Extending jQuery – jQuery plugin development

Some introductory words. jQuery is a very popular JavaScript library and why wouldn’t it be popular, it has made the life of us developers so so easy. Its not just that our lives have become easy, but so has our code-base become more cleaner. Anyways we are not going to discuss the merits of jQuery, I will have a separate post to discuss that. Right now what I would be discussing is how to write plugins for jQuery. Two ways of extending jQuery: There are two kinds of ways that you can extend jQuery. As you probably know that methods…

July 4, 2010   Views: 11,573   11 Comments