Wednesday, 22 May 2013

shaky live search - additional plugin for live search, delay keyup event until user finished typing!

So.. we had this issue with live search, it could be a bit shaky in producing result when user actually put a long keyword. Came across this lightweight plugin called 'typing' :

http://narf.pl/jquery-typing/

or if you prefer the github link :

https://github.com/narfdotpl/jquery-typing

using it is pretty simple too :

$(':text').typing({
    start: function (event, $elem) {
        $elem.css('background', '#fa0');
    },
    stop: function (event, $elem) {
        $elem.css('background', '#f00');
    },
    delay: 400
});

It will wait until the user actually not pressing any other key and then fire the keyup. We combine it with our liveSearch and it works very well!

No comments:

Post a Comment