There are many instances where we have to execute a function where we have no idea whether it actually exists or not. Let’s say for example, a function expects another function passed to it as parameter, which would later be executed as callback. A very common usage would be the callback function sent to AJAX requests.
Generally, we would code it with an if-block and check whether the variable (say,
callback) is a function or not. If it is, we execute it when we have the work completed (say marked by a variable called
Often, there are conditions where we need to provide a default value of a variable if it is
undefined. As a case study, we will take up the situation, where we are passing a Boolean value to function and if the input is
true, some action has to be taken. In case someone does not pass any value, the input is assumed to be
On 21st of June, the jQuery drag event plugin with iPhone (iOS) touch support was released. It has helped to add touch-based drag functionality to many existing web applications using the jQuery drag plugin. A minor update is released for this plugin that fixes the possibility of lack of touch-drag functionality on certain touch devices.
touchmove event and depend on native jQuery to do the rest.
Things turned out to be a bit trickier. After implementation, it struck us that with jQuery bound events,
event.pageX and other related mouse coordinate attributes would not work. Add to that, we were using the jQuery.event.drag plugin by ThreeDubsmedia to seal of the dirty job of drag-related coding.
Armed with the above two problems, we started to do what we thought would be the fastest solution – modify the jQuery.event.drag plugin for a graceful upscale!
Hello world, I am god.
On Earth, I had the dream to create life.
I am the one who painted green.
First, I weaved grass – they served a purpose.
They held onto the skin of my Earth.
Then chiselled trees with a different purpose.
I gave them fruit, knowing that someday
The fruits would serve some greater cause.