Recent Posts
Tags
 

jQuery

jQuery Mobile

22:27 14 May in JavaScript, jQuery, JSON, Thomas' Toolkit by Thomas

I've been on a jQuery Mobile based product for almost a week.  Its a revamp of a project I did 2 years ago. The original system ran on Wordpress just for the HTML shell, and my own custom JS, heavy on the AJAX, then later on jQTouch for mobile.  Its been a solid performer for about 2 years now, and a pretty hot item our clients, so there must be something to it. But, times change, and I'm feeling that jQuery Mobile is evolved enough now to take a real run at it. So far its been easy enough to learn, once you get by the whole 'pageinit' thing.  I'm only adapting the system, not rewriting it yet.  This job is "old brain in new body".  For the moment, I've found this works to call custom JavaScript for each page: $( document ).delegate( "#my_page_id",  "pageinit",  function() { $.ajax(...

jQuery Version Check: live() Vs. On()

12:34 31 January in Compatibility, JavaScript, jQuery, Thomas' Toolkit by Thomas

Recently I started work on my own jQuery plugins.  I do love that jQuery.  But, as I was working, I came to see the difference between on() and live(). I'm reading that live() is depreciated, so in order to make my plugin a bit more universal, I wrote a function to detect the jQuery version being used, and act accordingly.  Here it is: function useOn(){ var jRequired = '1.7.1'.split('.'); var jInstalled = jQuery.fn.jquery.split('.'); var on = true; for(x in jInstalled){ if(parseInt(jInstalled[x]) < parseInt(jRequired[x]) && on==true){ on = false; } } return on; } If the jQuery version is 1.7.1 or higher, this function will return true. If lower, it will return false. I call the function when I'm getting ready to set click functions on some of my objects. I couldn't find anything like it will poking around Google, so hopefully someone else finds this helpful. ...