Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem here seems to be with your HTML/CSS, not javascript/jquery. First, you should not have multiple divs with the same ID. So I am not sure why you have<code>#gcontainer</code> twice. If you want to apply the same style to multiple divs use classes. In your css, you are styling <code>#gcontainer</code> twice, which also does not make sense as the second time overwrites the first one. Also remember to always add <code>&lt;!DOCTYPE html&gt;</code> to the top of your pages or browsers will render in quirks mode, which can do all sorts of unexpected things.</p> <p>Anyways, I removed the extra #gcontainer in your HTML and CSS and edited some of the margins. Finally, I added a wrapper around the whole thing and put margin on the left, so your slide out would not go off the screen. This should work in IE and Chrome:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-1.7.min.js" type="text/JavaScript"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; #wrapper { margin-left: 100px; } #gheader{ height:50px; width:350px; background-color:#feee00; } #gtray{ height:250px; background-color:#006600; width:130px; float:left; margin-left:0px; margin-right:-130px; position:relative; z-index:0; overflow:hidden; } #gcontainer{ height:250px; width:320px; margin-left:30px; background-color:darkblue; float:left; position:absolute; } &lt;/style&gt; &lt;script type="text/JavaScript"&gt; $(function(){ $('#gtray').toggle( function() { $(this).stop(true).animate({marginLeft:'-100px'},'slow'); }, function() { $(this).stop(true).animate({marginLeft:'0px'},'slow'); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrapper"&gt; &lt;div id="gheader"&gt;&lt;h2&gt;HEADER&lt;/h2&gt;&lt;/div&gt; &lt;div id="gtray"&gt; &lt;span id="expander" style="width:30px;height:250px;float:left;background-color:red"&gt;O&lt;br&gt;p&lt;br&gt;e&lt;br&gt;n&lt;/span&gt; &lt;span style="float:left"&gt;asdas&lt;br&gt;SDasd&lt;br&gt;asdasdasd&lt;br&gt;asdasd&lt;br&gt;Sdasd&lt;/span&gt; &lt;/div&gt; &lt;div id="gcontainer"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </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. 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.
 

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