Note that there are some explanatory texts on larger screens.

plurals
  1. POCall external .js file after an element's CSS property changes
    primarykey
    data
    text
    <p>I had the same issue as mentioned <a href="https://stackoverflow.com/questions/4647747/google-maps-api-strange-map-offset-behaviour">here, with an embedded Google Map being offset</a>, and not being very javascript-savvy, I'm at a loss as to how to resolve this in an ideal fashion.</p> <p>I'm using the jQuery Tools library to make a "wizard" of sorts for my users, as outlined here: <a href="http://flowplayer.org/tools/demos/tabs/wizard.html" rel="nofollow noreferrer">http://flowplayer.org/tools/demos/tabs/wizard.html</a></p> <p>One of the panes of the wizard has an embedded Google Map. The map has the problem mentioned in the OP.</p> <p>To prevent the flash of all the panes of the wizard being initially visible until the jQuery Tools script hides them, I gave the panes the CSS property of "display: none" (except for the first pane). This is the root cause of the issue - commenting out that line in the CSS results in the panes being momentarily visible, and the embedded Google Map working properly.</p> <p><strong>My question is simple</strong>: how would I render the following pseudo-jQuery-code in proper jQuery/javascript?</p> <pre><code>when (.pane.hasMap).css("display") == "block" { load/run external google-maps.js file } </code></pre> <p>Also, would I need it to run every time the user switches to the pane with the map, or just the first time?</p> <p>EDIT:</p> <p>Gah... I just discovered that the Google Maps plugin for my CMS is automatically inserting the script into the page far above where I had been manually (and redundantly, as it turns out) specifying the script. So, I have no control over when the script is called and the map is rendered.</p> <p>So, the only alternative I can think of is to have the map's container positioned way off-screen, and then restore it back into place when the tab is called. Something like this perhaps?:</p> <pre><code>if ( $(".pane.hasMap").is(':visible') ) { $(".mapContainer").css("top", "0", "left", "0"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload