jQTouch
jQTouch copied to clipboard
google maps - multiple integration, and tab bar problem
Im trynig to do a good solution for multiple google maps in a JQTouch web app and phone gap app.
This is extremely painstaking as have been trying fo rmonths. But ihave got close to a good solution, and have posted the code/repo below:
https://github.com/surfjedi/google-map-problem
PROBLEM:
in the above repo maps work, size fine, BUT after going to a map once you cant see it again, it show only the last map page veiwed.
For example:
- got to admin direct map. then go back to main list.
- got to Aj's tyres, then back to main list
- hit admin direct agin, but it shows Aj's tryes.
Notes:
- Seems to work better with older JQTOUCH r166, and jquery 1.4.2
- Have got very close to his working with either seperate html map pages(divs) or div inside #JQT div
Any one have any great ideas? It like the #map-details div isntgetting destroyed once going back from a map.
Thanks is advance to any one that can help
I remove my map panels after I leave them to force them to reload. I had this problem way early on and this was the best solution I could come up with when I knew the content changed. The other option is to leave the map alone and just rebuild the markers etc. I will do that if the user just wants to turn certain marker types on/off. I have a flag that I set and use the animation binds to trigger one or the other above.
I have some code that supposed to do this but its not worklng.
$('.clear-map-detail').live('pageAnimationStart', function(event, info){
if (info.direction == 'in') {
console.log('clear map detail');
$('#map-detail').remove();
$('#map-detail').unbind(); // completely remove it from the DOM
$('body').unbind('turn');
map_moved = false;
}
});
I had it working with a single map div inside #JQT, and now switched to map pages in seperate files loaded by ajax.
But now the map.init.js cant get the map_initialize() finction in the map page.
ReferenceError: Can't find variable: map_initialize - keeps coming up
I have updated the code in the rep o above to this,
Any one have any ideas? thanks in advance
Progress have fixed above but now it freezes the web app after going back from map page.
Its got somthing to do wiht the .clear-map-detail class/function. it will go back and forth with out it, but ma is same on all pages. with it you can only go to one map before it freezes. See my "step branch"
Just a comment. You have to make sure that you do not remove the panel that the map was on, just the map object itself. Removing the panel can cause these symptoms. Not saying you did that as I did not look at the code.
Also make sure you are not recreating a new instance of the map panel with the same ID's etc.