Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The way Google has implemented this functionality is by adding a <code>&lt;div&gt;</code> element with <code>position: absolute;</code> styling that contains the sidebar html. They include a button for toggling that simply moves the panel off the screen. The following jsFiddle should get you started on what you want to do: <a href="http://jsfiddle.net/x8rfd/4/" rel="nofollow">http://jsfiddle.net/x8rfd/4/</a></p> <p>I haven't made it look pretty; this is just a demonstration of one way to make a panel show/hide with Google Maps. You can position and style your button however you like, and put whatever content you want in the panel.</p> <p>Keys to success for Google Maps API CSS: remember that your map canvas needs a height and a width:</p> <pre><code>#map-holder { position: absolute; height:300px; width:100%; } #map { width: 100%; height: 100%; } </code></pre> <p>Answer:</p> <p>Here is a function that you can run on two elements and resize them at the same time</p> <pre><code>/* * @param el1 the jQuery element to move (not null) * @param el1 the jQuery element to resize (not null) * @param pos the position to move it (not null) * @param dur the duration to move it (not null) * @param shw show or hide * @param f1 function to call every x loops * @param x see above * @param f2 function to call once done */ Maps.ui.slide = function(el1, el2, pos, dur, shw, f1, x, f2){ shw = (shw===null)?false:shw; x = (x===null)?1:x; f1 = (f1===null)?new function(){}:f1; f2 = (f2===null)?new function(){}:f2; dur = (dur===null)?1000:dur; dur = dur/pos; var p = pos/100; var t = 0; var r = x; var to = function(){ if(!shw &amp;&amp; t &lt; 100){ t += p; t = (t &gt; 100)?100:t; el1.css("left", "-" + pos - (pos * t/100)); el2.css("left", pos - (pos * t/100) ); if(r == 0){f1();r=x;}else r-=1; setTimeout(to, dur); }else if(shw &amp;&amp; t &lt; 100){ t += p; t = (t &gt; 100)?100:t; el1.css("left", pos - (pos * t/100)); el2.css("left", (pos * t/100)); if(r == 0){f1();r=x;}else r-=1; setTimeout(to, dur); }else if(t &gt;= 100){f1();f2();} } setTimeout(to, dur); }; </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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