Category: jQuery

  • jQuery: Global AJAX Events for Start, Stop, Complete, or Error

    When your website contains a lot of AJAX requests using jQuery template and you want to add a global event at the start or finish of the AJAX request, e.g. add a spinning icon, or handle all AJAX errors in a particular fashion.

    The jQuery library provides multiple events for ajax event handlers. This article will focus on ajaxStart and ajaxError.

    (more…)

  • Node.js – Ajax Pagination without the Pages

    With my recent endeavours into Node, I thought that taking a fun article like this one – CakePHP 2-0 Ajax Pagination WITHOUT The Pages – would be a really fun experiment to see how difficult it would be to accomplish in Node.

    At the end of the day, the logic is still the exact same, retrieve the items, determine the max length, calculate the number of pages, and then perform AJAX as well scroll down to fill in more content as-needed.

    Leveraging the Express API and Jade templates, this is quite painless to implement into Node with jQuery template.

    (more…)

  • Using Jquery to Check a Checkbox

    This is an excellent follow up on a recent post – Determine if an element is visible with Jquery – because in that post we use the is Jquery operator to check if an item is visible or hidden.

    Spoiler alert, in this article, we can leverage the exact same function by altering the value of the selector passed into it.

    (more…)

  • Determine if an element is visible with Jquery

    When I interview web developers, I always like to ask the following basic Javascript question:

    Write a function in Javascript that will ‘toggle’ or show/hide an element upon being fired.
    [code]
    function toggle(elementIdValue) {

    }
    [/code]

    I typically see one of two answers: Jquery or classic JavaScript.  Both of course are effective.  But, in this article I’m going to demonstrate another way as well.

    (more…)

  • A Fancier Twitter Timeline

    I truly enjoy the finer things in life.  For example, if I’m going to eat a steak I don’t want some fatty low grade piece of meat.  I would much rather (in this case, spend the additional money) to get an AAA grade of meat.  The taste is worth it.

    The same is true with development; the Twitter Timeline is “nice”, but I personally don’t want a linear, scrollable representation of my Tweets!  I want the AAA grade where in this case it just takes a little bit more time instead of money…  As you can see above, my Tweets are sliding in and out every 7.5 seconds.  Once it cycles through my latest 10, it restarts again.

    (more…)