DMXzone Google Maps Support Product Page

Solved

Google Maps doesn't work correctly when placed within DMXZone Tabs

Reported 02 Mar 2012 13:29:02
2
have this problem
02 Mar 2012 13:29:02 Neil Morphew posted:
Google Maps doesn't work correctly when placed within DMXZone Tabs, map image does not display completely. It seems to be offset to the top left.

If you have tabs and google maps separately on the page everything is ok, but if you place the map in one of the tabs it shows the problem.

site1.nsse.co.uk/contact.asp

Thanks

Promoted Solutions

Replied 02 Mar 2012 18:05:03
Hello guys here is the workaround :

Seems like there is a bug in the Jquery library.

Any component that requires some dimensional computation for its initialization won't work in a hidden tab, because the tab panel itself is hidden via
display: none
so that any elements inside won't report their actual width and height (0 in most browsers).

There's an easy workaround. Use the off-left technique for hiding inactive tab panels. E.g. in your style sheet replace the rule for the class selector ".ui-tabs .ui-tabs-hide" with

.ui-tabs .ui-tabs-hide {
    position: absolute;
    left: -10000px;
}


For Google maps you can also resize the map once the tab is displayed like this:

$('#example').bind('tabsshow', function(event, ui) {
    if (ui.panel.id == "map-tab") {
        resizeMap();
    }
});

resizeMap() will call Google Maps' checkResize() on the particular map.

Replies

Replied 02 Mar 2012 14:06:27
02 Mar 2012 14:06:27 Neil Morphew replied:
An update to my question above.

The problem seems to occur when this style is added:-

.ui-tabs .ui-tabs-hide { display: none !important; }

This is in the hot-sneaks.css file, but I think it is also in the other style sheets for different themes.

If you take this style out the map displays correctly (but the tabs do not), put it back in and the problem returns.

Thanks
Replied 02 Mar 2012 17:19:48
02 Mar 2012 17:19:48 Neil Morphew replied:
Another update to my question above.

I've just found that IE8 renders the page correctly... comes to something when the older browsers get something right and the newer versions don't.

Hopefully that info may help in searching for an answer.

Thanks
Replied 02 Mar 2012 17:27:55
02 Mar 2012 17:27:55 Robin Schafer replied:
I had the same problem only using Spry Tabs in DW.

I found the the map will only position correctly if placed in the first tab. I know it does not answer your issue but it is a work around.

I believe a solution was requested for this in the past by another member but I never saw a resolution.
Replied 02 Mar 2012 17:36:15
02 Mar 2012 17:36:15 Neil Morphew replied:
Hi Robin

Have moved the map to the first tab and it works ok. Tried it in second tab and the same problem appeared.

It must be something to do with the initial laying out of the page, working when shown first but not once it's in the hidden tab content.

Hopefully they'll come up with a working solution, until then I'll have to persuade the customer that that is the best place for the map.

Many thanks for the reply
Replied 02 Mar 2012 17:38:48
02 Mar 2012 17:38:48 Neil Morphew replied:
Incidentally, if someone else is still investigating this problem I'll leave a test page up at site1.nsse.co.uk/test.asp for a while.

Thanks
Replied 02 Mar 2012 18:05:03
02 Mar 2012 18:05:03 Vulcho Vulev replied:
Hello guys here is the workaround :

Seems like there is a bug in the Jquery library.

Any component that requires some dimensional computation for its initialization won't work in a hidden tab, because the tab panel itself is hidden via
display: none
so that any elements inside won't report their actual width and height (0 in most browsers).

There's an easy workaround. Use the off-left technique for hiding inactive tab panels. E.g. in your style sheet replace the rule for the class selector ".ui-tabs .ui-tabs-hide" with

.ui-tabs .ui-tabs-hide {
    position: absolute;
    left: -10000px;
}


For Google maps you can also resize the map once the tab is displayed like this:

$('#example').bind('tabsshow', function(event, ui) {
    if (ui.panel.id == "map-tab") {
        resizeMap();
    }
});

resizeMap() will call Google Maps' checkResize() on the particular map.
Replied 02 Mar 2012 18:15:23
02 Mar 2012 18:15:23 Neil Morphew replied:
Hi Vulcho,

have tried your suggestion and it works fine.

Thanks for the speedy reply.
Replied 02 Mar 2012 18:42:17
02 Mar 2012 18:42:17 Robin Schafer replied:
Neil.


What did you update? I do not see it in your code, is it in one of the external script files. I'd appreciate seeing the code of a live example.

Particularly the Function call. the CSS is not problem

Thanks
Replied 02 Mar 2012 19:10:00
02 Mar 2012 19:10:00 Neil Morphew replied:
Hi Vulcho,

updated the page site1.nsse.co.uk/contact.asp.

I made the change to the .ui-tabs .ui-tabs-hide in the hot-sneaks.css file and then moved the map tab to the second position.

Checked in most of the new browsers and seems to be working fine.

Didn't use the Function call at all.

Thanks
Replied 02 Mar 2012 19:39:52
02 Mar 2012 19:39:52 Neil Morphew replied:
Hi Vulcho

just discovered an error which may be related to the work-round you suggested as I don't remember seeing it earlier.

If you request directions on the map tab and then select one of the other tabs the backgrounds (for the dmxGMDirections class) don't seem to disappear and overlay the other tab panels?

Initially, I thought it may be because I was using transparency on the backgrounds but when I remove this it still occurs.

Obviously, if you don't request directions this doesn't happen.

Thanks
Replied 03 Mar 2012 09:38:55
03 Mar 2012 09:38:55 Vulcho Vulev replied:
Hello Neil.

The problem seems to be appearing in IE only. I will take a look at more depth at the issue with our developers.

Best regards: Vulcho.
Replied 05 Mar 2012 10:27:30
05 Mar 2012 10:27:30 Neil Morphew replied:
Hi Vulcho

I am getting the problem in other browsers as well (I normally use Chrome).

I have removed the CSS work around (on this page, site1.nsse.co.uk/contact.asp) and this has solved that problem, and have made the Map tab the first one so that it works correctly.

If you want to see the problem I have made it the test page here, site1.nsse.co.uk/test.asp, and this uses the CSS work around.

Thanks
Replied 06 Apr 2013 09:09:28
06 Apr 2013 09:09:28 Juan Olarte replied:
Hi I am having the same problem, my CSS document doesn’t have the (.ui-tabs .ui-tabs-hide). I tried adding the (.ui-tabs .ui-tabs-hide) to the black-tie.css document, and even replacing some of the (.ui-tabs) settings with the settings from the (.ui-tabs .ui-tabs-hide), but nothing worked. I am wondering if anyone has found a solution for this.

Thanks

Juan
Replied 08 Apr 2013 07:13:04
08 Apr 2013 07:13:04 Vulcho Vulev replied:
Hello Juan ,

You need to execute redraw behavior in order to show the map inside the tab.
Please take a look at the following video tutorial:


Using DMXzone Google Maps Inside DMXzone Tabs


Regards:Vulcho.
Replied 08 Apr 2013 07:37:49
08 Apr 2013 07:37:49 Juan Olarte replied:
Hi Vulcho—
Thanks a lot for your help, it works perfectly.

Taka care
Juan

Reply to this topic