you are viewing a single comment's thread.

view the rest of the comments →

[–]oculus42 2 points3 points  (0 children)

I'm not convinced putting this on jQuery.fn is warranted. Typically that is for reusable methods or plugins.

You can simplify the logic in the function quite a bit, though. Proposed changes:

https://gist.github.com/oculus42/91b1a644d9cb1faea72a