javascript - Make image appear half on screen, other half scroll to see -


the idea website there video playing in background takes entire width , height of browser when go it. scroll down , rest of content. far have video part of working. part causing me trouble picture of iphone needs included. half of phone covering part of video. other half need scroll down see (along rest of content). need phone 1. appear in position, no matter window size; , 2. scale same ratio of phone size window size.

i've tried many things functioning, hasn't seemed work me yet.

<script>         $(function(){             $('#video').css({ width: $(window).innerwidth() + 'px', height: $(window).innerheight() + 'px' });              $(window).resize(function(){                 $('#video').css({ width: $(window).innerwidth() + 'px', height: $(window).innerheight() + 'px' });             });         });      </script> </head> <body>     <iframe id="video" src="http://www.youtube.com/embed/sltvlijvdnw?hd=1;autoplay=1;controls=0;showinfo=0;" frameborder="0" allowfullscreen></iframe>     <div id="box">         <img id="iphone" src="img/phone.png" alt="iphone" />     </div>     <div id="test"></div> </body> 

html, body { border: 0px; margin:0px; padding:0px; }  body { overflow: hidden; }  #test { width:400px; height:400px; background-color:blue; }  #box { position:absolute; max-width:280px; left:10%; top:380px; }  #iphone { max-width: 100%; } 

here pure css solution, assuming understood problem correctly:

http://jsfiddle.net/5avza/1/

css:

html, body {     margin: 0;     padding: 0;     width: 100%;     height: 100%; }  .video {     background: black;     width: 100%;     height: 100%; } .iphone {     width: 50%;     margin: 0 auto;     display: block;     margin-top: -25%;     position: relative;     z-index: 2; } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -