I don't really know what you question is about because you didn't tag it with Javascript, but I think if you knew this, you would have asked what google.maps.event.trigger(X, Y)
did. Plus, I don't know what this has to do with your div
tags in your PHP files.
Google Maps API answer
It's simple to find out what trigger
does here:
Triggers the given event. All arguments after eventName are passed as arguments to the listeners.
(From the Google Maps API, I found it in no time)
Javascript answer
If your question is about this whole &&
construct, I'll explain it to you:
map && google.maps.event.trigger(map, 'resize');
The &&
is a logical AND with short-cirquit evaluation which means:
If its first argument is true, it evaluates the second argument. Iff this is true too, it returns true.
If its first argument is false, the whole expression can't become true, so it doesn't even evaluate its second argument and returns false immediately.
This mechanism can be (ab)used to change flow control. If the condition (&&
's first argument) is false, the second argument doesn't get evaluated, so it's the same as
if (map) {
google.maps.event.trigger(map, 'resize');
}
I don't know how map
was initialized, but maybe the event trigger is added only if there's a map
element.