Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>here is an update which is very similar to <a href="http://www.yesstudio.co.uk/" rel="nofollow">http://www.yesstudio.co.uk/</a>. </p> <p><strong>HTML</strong></p> <pre><code>&lt;div id="content"&gt; &lt;div class="stretchy-wrapper"&gt; &lt;div&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>CSS</strong></p> <pre><code>&lt;style&gt; body, html { height: 100%; background: #f0f0f0; overflow:hidden } #content { background: #FFF; margin: 0 auto; } div.stretchy-wrapper { margin: 0 auto; position: relative; background: #000; width:100%; height:100% } div.stretchy-wrapper &gt; div { position: absolute; top: 0; bottom: 0; left: 0; right: 0; } &lt;/style&gt; </code></pre> <p><strong>js</strong></p> <pre><code> &lt;script&gt; function resize(){ var winwidth, winheight, conwidth, conheight, imgheight, imgwidth, top, left; winwidth = $(window).width(); winheight = $(window).height(); conwidth = winwidth - 260; if(conwidth &lt; 493){ conwidth = 493; } conheight = winheight - 95; conratio = conwidth/conheight; imgwidth = 1200; imgheight = 800; imgratio = 1200/800; if(conratio &lt; imgratio){ width = conwidth; height = conwidth / imgratio; } else { height = conheight; width = conheight * imgratio; } if(width &gt; imgwidth || height &gt; imgheight){ width = imgwidth; height = imgheight; } top = (winheight/2) - (height/2); left = (winwidth/2) - (width/2); arrowheight = Math.round((winheight - height) / 2); if(left &lt; 130){left = 130; } $("#content").css("top",top+"px").css("left",left+"px"); $("#content").css("height",height+"px").css("width",width+"px"); } $(window).resize(resize); $(document).ready(function(e) { resize(); }); &lt;/script&gt; </code></pre> <p>And Finally here is a working <strong><a href="http://jsfiddle.net/geovani075/TVJws/" rel="nofollow">Demo</a></strong> :) Enjoy</p>
 

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