Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's a very simple solution using jQuery's <code>animate</code> method for the meat. (Working <a href="http://jsfiddle.net/rFbTZ/" rel="nofollow noreferrer">demo</a> and code below.)</p> <p><strong>HTML</strong></p> <p>You need three basic elements: a container (<code>#slideout</code>), its contents (<code>#slideout_contents</code>), and a toggle button (<code>#slideout_toggle</code>).</p> <pre><code>&lt;body&gt; &lt;div&gt;Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents. Page contents.&lt;/div&gt; &lt;div id="slideout"&gt; &lt;div id="slideout_contents"&gt; &lt;a id="slideout_toggle"&gt;Open&lt;/a&gt; &lt;h1&gt;Header&lt;/h1&gt; &lt;p&gt;Some text.&lt;/p&gt; &lt;p&gt;Some text.&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt;​ </code></pre> <p><strong>CSS</strong></p> <p>You need to position it absolutely so it hugs the left edge of the screen.</p> <pre><code>body { padding: 0px; margin: 0px; } #slideout, #slideout_contents, #slideout_toggle { background: #000; /* to see it on a blank page */ color: #fff; position: absolute; top: 0px; } #slideout_contents { left: -100px; /* adjust these */ width: 100px; height: 300px; } #slideout_toggle { display: block; text-decoration: none; top: 50%; left: 100px; width: 50px; text-align: center; }​ </code></pre> <p><strong>JavaScript (jQuery)</strong></p> <p>jQuery's <code>animate</code> method takes care of the rest.</p> <pre><code>$('#slideout_toggle').toggle(function(){ $(this).html('Close'); $('#slideout_contents').animate({'left': '0px'}); },function(){ $(this).html('Open'); $('#slideout_contents').animate({'left': '-100px'}); }); </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.
    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