Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Comment | File | Size | Author |
---|---|---|---|
#4 | white.jpg | 2.64 KB | anikitin35 |
Comment | File | Size | Author |
---|---|---|---|
#4 | white.jpg | 2.64 KB | anikitin35 |
Comments
Comment #1
hutch CreditAttribution: hutch commentedLooks like quicktabs is another one of those modules that hides the map, Google's T&C demands that the map be visible at all times, if their software detects that the map request is hidden then it aborts the load which looks like what has happened.
Comment #2
anikitin35 CreditAttribution: anikitin35 commentedAfter click tab the map must be reinitializate.
Comment #3
hutch CreditAttribution: hutch commentedCorrect, in order to reinitialize the map you must reload the page.
Comment #4
anikitin35 CreditAttribution: anikitin35 commentedDear, friend. Thank you for a very good module.
Please help with little problem.
When error message on the page map is white.
Now it's a main problem for me in use module...
What decision is available?
Comment #5
hutch CreditAttribution: hutch commentedI need more information, the image is unreadable.
Comment #6
anikitin35 CreditAttribution: anikitin35 commentedThank you for a fast reply. Please see my question "White map after error message".
When page is reloaded, map is white.
If I view map in tab, map is unreacheble.
Comment #7
hutch CreditAttribution: hutch commentedThe map is empty because you have a javascript error. See #1 for why you cannot view a map in a tab.
Comment #8
pyzdera CreditAttribution: pyzdera commentedHi,
Thank you for your very useful module
The fact that google maps does not work correctly in tabs is a known problem. You can usually fix this by calling the command string, after the activation of the map tab:
View source -> http://blog.codebusters.pl/demo/ukryta_mapa_rozwiazanie1.html
and description -> http://blog.codebusters.pl/pl/entry/google-maps-w-ukrytym-div
If GetLocations seems like it should be like this:
However, this solution does not work, if anyone can write what should be the function of resizing and recentering the map?
Sorry for my english, I hope that what I write is understandable.
Best Regards
Comment #9
hutch CreditAttribution: hutch commentedHow about something like this:
Comment #10
pyzdera CreditAttribution: pyzdera commentedThere are not working, and not working with my API - Error: "TypeError: getlocations_map [key] is undefined"
Comment #11
hutch CreditAttribution: hutch commentedYou will need to make sure that it is loaded after getlocations.js
Look in your source html.
Comment #12
pyzdera CreditAttribution: pyzdera commentedI'm using the bootstrap tabs. The script is loaded at the very end, just before the /body tag. GetLocations load files in the head.
Script fragment responsible for switching tabs:
in my script the "alert" is working properly, so the script captures the moment of switching the tab with the map
Comment #13
pyzdera CreditAttribution: pyzdera commentedThank you very much for pointing :) works in this version:
var key = 'key_2';
Best regards
Comment #14
hutch CreditAttribution: hutch commentedExcellent!
If you can write this up in full that would help others, see https://drupal.org/node/2036635 which is where I want to put things like this, if you have editing rights you can put it there yourself.
Comment #15
pyzdera CreditAttribution: pyzdera commentedHello,
I added the solution to the problems of the location map to tabs.
If possible, you please correct my English so as to be understood by all.
Thank you for your help in solving. A small thing, but a nice one :)
Best Regards
Comment #16
hutch CreditAttribution: hutch commentedThank you very much, I will just tidy things up a bit.
Comment #17
m33_nft CreditAttribution: m33_nft commentedAny patch?
Comment #18
hutch CreditAttribution: hutch commentedSee Quicktabs example 2 for a howto for quicktabs
Comment #19.0
(not verified) CreditAttribution: commentedLink
Comment #20
Nikita Petrov CreditAttribution: Nikita Petrov commentedQuicktabs example 2 is a very good solution, thank you! But there is some obsolete code ($settings2 is't working for me), so I wrote some additional code (I use Drupal.settings.getlocations settings).
My soution is:
Comment #21
hutch CreditAttribution: hutch commented$settings2 will work with any version after 7.x-1.11 (or therabouts), current stable is 7.x-1.13.
I would strongly recommend upgrading, there are many fixes and improvements in Getlocations.
Comment #22
pedrosmoker CreditAttribution: pedrosmoker commentedHi,
I am trying to setup my map with Quicktabs module, i have read all the instructions,installed 'jQuery Update version 1.7' put the 'scripts[] = script.js' in mytheme.info copy/paste the code from 'Quicktabs example 2' in theme folder as script.js, my problem is that i can t figure out what to change in the code , at the top of the code i have changed 'Drupal.behaviors.mytheme' to 'Drupal.behaviors.kinetosfat.ro' kinetosfat.ro is my theme name, then // the machine name of your quicktabs block var block = 'maps'; i did not changed becouse my quicktabs instance is called maps then is('div')) changed with is('.front')) , var tabnum = 0; because the map is under the first tab and finaly redomap('key_3'); my map key. I can t figure out what to change in the code.
I ended with this but is not working.
/**
* Refresh maps hidden in quicktabs
*
*/
(function ($) {
Drupal.behaviors.kinetosfat.ro = {
attach: function() {
function redomap(key) {
var settings = Drupal.settings.getlocations[key];
var settings2 = getlocations_data[key];
var minmaxes = (settings2.minmaxes ? settings2.minmaxes : '');
var minlat = '';
var minlon = '';
var maxlat = '';
var maxlon = '';
var cenlat = '';
var cenlon = '';
if (minmaxes) {
minlat = parseFloat(minmaxes.minlat);
minlon = parseFloat(minmaxes.minlon);
maxlat = parseFloat(minmaxes.maxlat);
maxlon = parseFloat(minmaxes.maxlon);
cenlat = ((minlat + maxlat)/2);
cenlon = ((minlon + maxlon)/2);
}
google.maps.event.trigger(getlocations_map[key], "resize");
if (! settings.inputmap && ! settings.extcontrol) {
if (settings.pansetting == 1) {
Drupal.getlocations.doBounds(
getlocations_map[key],
minlat,
minlon,
maxlat,
maxlon,
true
);
}
else if (settings.pansetting == 2) {
Drupal.getlocations.doBounds(
getlocations_map[key],
minlat,
minlon,
maxlat,
maxlon,
false
);
}
else if (settings.pansetting == 3) {
if (cenlat && cenlon) {
var c = new google.maps.LatLng(
parseFloat(cenlat),
parseFloat(cenlon)
);
getlocations_map[key].setCenter(c);
}
}
}
}
// use this example for a leaflet map
function redoleafletmap(key) {
var settings = Drupal.settings.getlocations_leaflet[key];
var minmaxes = (getlocations_leaflet_data[key].minmaxes ? getlocations_leaflet_data[key].minmaxes : '');
var datanum = getlocations_leaflet_data[key].datanum;
if (datanum > 1) {
if (minmaxes) {
var mmarr = minmaxes.split(',');
var sw = L.latLng(parseFloat(mmarr[2]), parseFloat(mmarr[3])),
ne = L.latLng(parseFloat(mmarr[0]), parseFloat(mmarr[1])),
bounds = L.latLngBounds(sw, ne).pad(0.1);
getlocations_leaflet_map[key].invalidateSize().fitBounds(bounds, {reset: true});
}
}
// the machine name of your quicktabs block
var block = 'maps';
// are you on a page with your quicktabs
if ($("#quicktabs-" + block).is('#front')) {
// the first tab is '0', the second tab is '1' etc
var tabnum = 0;
$("#quicktabs-" +
block +
" a#quicktabs-tab-" +
block + "-" + tabnum).one('click', function(event) {
// each map has a key, eg key_1, key_2 etc
redomap('key_3');
});
// another tab with another tabnum and map key here
var tabnum = 2;
$("#quicktabs-" +
block +
" a#quicktabs-tab-" +
block + "-" + tabnum).one('click', function(event) {
// each map has a key, eg key_1, key_2 etc
redomap('key_2');
});
// another tab with another tabnum and map key here
// this one handles a leaflet map
var tabnum = 3;
$("#quicktabs-" +
block +
" a#quicktabs-tab-" +
block + "-" + tabnum).one('click', function(event) {
// each map has a key, eg key_1, key_2 etc
redoleafletmap('key_3');
});
}
}
};
})(jQuery);
Comment #23
hutch CreditAttribution: hutch commentedFirst of all change
Drupal.behaviors.kinetosfat.ro
toDrupal.behaviors.kinetosfat_ro
. Dots have "meaning" in javascript.The is() function needs to have a html element, not a class or id, so div, p, h3, input, select etc
see http://api.jquery.com/
You can use
Drupal.getlocations.redoMap('key_3')
instead ofredomap('key_3');
and leave out the function redomap() altogether, same forredomap('key_2');
Same goes for
redoleafletmap(key)
, useDrupal.getlocations_leaflet.redoMap()
This assumes you are using getlocations_leaflet module.
I am not sure why you have two maps with the same id, eg 'key_3', each map should have a distinct id.
Comment #24
pedrosmoker CreditAttribution: pedrosmoker commentedGreat, is working now, i had two options: copy/ paste this code in my css file
.quicktabs-hide {
display: block;
position: absolute;
left: -10000px;
top: -10000px;
}
Or chose your your js code from 'Quicktabs example 2 ', both of them are working but finally i used your code.
For the moment the map is displaying properly using quicktabs Ajax option 'No: Load all tabs on page view.' but when my 'all nodes view map' will have a substantial content on it i think this will cause a slow page load, so i am trying to display the map with the 'Ajax Yes: Load only the first tab on page view' the first tab will be a normal text block and the second will be the map loaded with ajax, but this option is failing the load the entire map (blank).
I found this but is not doing me any well :
(function ($) {
Drupal.behaviors. = {
attach: function (context, settings) {
$('.quicktabs-tabs a', context).click(function() {
//New tab has been clicked, remove the opened tab page
$(".quicktabs-tabpage").remove();
$('.quicktabs-tabs a').removeClass('quicktabs-loaded');
});
}
}
})(jQuery)
Comment #25
hutch CreditAttribution: hutch commentedQuicktabs ajax load will not work because there will not be any javascript installed to run the maps as you can see in the source html when quicktabs ajax is enabled. The maps are not "sent" from the webserver, they are fetched from the mapservers direct to the browser.
Comment #26
pedrosmoker CreditAttribution: pedrosmoker commentedI understand, you think if i can writte a custom javascript will solve my problem?
Comment #27
hutch CreditAttribution: hutch commentedYou can try.
I would do your best to speed up the map, as few layers and markers as possible, use a markermanager, there are two of them available.
Comment #28
joonapenttila CreditAttribution: joonapenttila commentedIs there any good script for this issue ?