]> asedeno.scripts.mit.edu Git - bluechips.git/blobdiff - bluechips/public/js/mobile.js
more refinements to the iphone targeted interface, improved validation functionality...
[bluechips.git] / bluechips / public / js / mobile.js
index 6d01307dd55fb988d4032efa13b678da71850855..a7ab3266d5d65627dd1cde160039b0d1a1009e55 100644 (file)
@@ -8,12 +8,21 @@ $(function() {
     console.log("ready()");
 
     $('#tabs a').click(function() {
-        $('div.tab').hide();
         $('#tabs a').removeClass('selected');
         $(this).addClass('selected');
-        $('#tab-' + $(this).attr('id')).show();
+        $('div.tab').hide();
+
+        /* See if that tab has been rendered to the page. */
+        tabname = '#tab-' + $(this).attr('id');
+        tab = $(tabname);
+        if(tab.children().length < 1) {
+            /* If not, return true so that we actually reload. */
+            tab.load($(this).attr('href') + ' ' + tabname + '> *');
+        }
+        tab.show();
         return false;
     });
+    $('#tabs a.selected').click();
 
     console.log("ready() done");
 });