There are a few jQuery plugins out there that will manage your dropdowns and delays if the visitor accidentally mouses-off the element and keeps it open for xx milliseconds, so it doesn't close instantly and the visitor doesn't have to start again.
Here is a quick jQuery example to set a delay and kill it if...
Read more
Avoid double click on iPod/iPad/iOS when using jQuery click()
On a recent project, I was using the usual jQuery click() method to trigger an event when a link was clicked. This worked just fine on everything I tested (Mac, Windows, Android) but when it came to an iPhone, a single click wasn't enough...I had to click twice. Very weird behavior. After...
Read more
Modifying browser history and url using jQuery
You open a popup and actually want the browser url to reflect the popup/overlay url. You do this for multiple reasons, but mainly for SEO and social media links. It also allows the visitor to use the 'back' button and have your page react using AJAX instead of actually reloading the previous page.
Here's...
Read more
How to abort a jQuery ajax call before starting a new call
Sometimes you need to trigger an action based on keyup (or any other kind of key stroke action). Usually not a big deal to trigger an action on every key stroke, but if that action triggers an ajax call, you can have many ajax calls running if you're a fast typer :)
So its a...
Read more
Playing with hash tags in url with javascript – add, remove, and modify hash tags
Sometimes its fun and beneficial to use hash tags in urls (#modify) instead of GET values (?action=modify). Hash values can be added and modified, so the values can be changed while the user interacts with the page. jQuery isn't really useful in this case, since we're just using native javascript for this...it's simple...
Read more
Make a JSON object and send via ajax POST using jQuery
Use jQuery to send a JSON object via POST. Everything EXCEPT the ajax call is done with simple javascript and jQuery is not needed. This is nice since JSON.stringify() will take care of special characters and other special cases you would have to check for manually. A little protection from posting plain...
Read more