X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=bluechips%2Fpublic%2Fjs%2Fmobile.js;h=a7ab3266d5d65627dd1cde160039b0d1a1009e55;hb=4eb26869c8a67e39b0444a0b57a9df26f7b6e950;hp=6d01307dd55fb988d4032efa13b678da71850855;hpb=0b9f273d12cbbe8790c4a9dec14d282a461e54be;p=bluechips.git diff --git a/bluechips/public/js/mobile.js b/bluechips/public/js/mobile.js index 6d01307..a7ab326 100644 --- a/bluechips/public/js/mobile.js +++ b/bluechips/public/js/mobile.js @@ -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"); });