javascript - Adjusting height of iframes in jQuery Masonry (YouTube embeds) -


total noob here, trying put jquery masonry page youtube video embedded.

problem is, height of video not adjusting, , can't figure out how proportions right.

i've looked @ following links, can't figure out how incorporate these ideas code.

jquery - how dynamically adjust height of iframe?
adjust height of iframe when new content loaded

my entire block of code below. you'll notice div adjusts fine image, fails adjust appropriately embedded youtube video.

where going wrong? appreciated...

<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>article title</title>  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>  <style> body {     font: 1em/1.67 arial, sans-serif;     margin: 0;     background: #e9e9e9; }  img, iframe { max-width: 100%; height: auto; display: block; }  .wrapper {     width: 95%;     margin: 3em auto; }  .masonry {     margin: 1.5em 0;     padding: 0;     -moz-column-gap: 1.5em;     -webkit-column-gap: 1.5em;     column-gap: 1.5em;     font-size: .85em; }  .item {     display: inline-block;     background: #fff;     padding: 1.5em;     margin: 0 0 1.5em;     width: 100%;     box-sizing: border-box;     -moz-box-sizing: border-box;     -webkit-box-sizing: border-box;     box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.18);     border-radius: 3px;     -moz-border-radius: 3px;     -webkit-border-radius: 3px; }  .title, .footer { text-align: center; }  .title h1 { margin: 0; }  .title { display: inline-block; padding: .75em 1.25em; color: #888; border: 2px solid #aaa; margin: .25em 1em 1em; text-decoration: none; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; }  .title { color: #666; }  .title a:hover { color: #666; border-color: #888; }  .footer { font-size: .75em; }  .footer, .footer { color: #888; }   @media screen , (max-width: 800px) {     .masonry {         -moz-column-count: 1;         -webkit-column-count: 1;         column-count: 1;     } }   @media screen , (min-width: 800px) {     .masonry {         -moz-column-count: 2;         -webkit-column-count: 2;         column-count: 2;     } }  @media screen , (min-width: 900px) {     .masonry {         -moz-column-count: 2;         -webkit-column-count: 2;         column-count: 2;     } }  @media screen , (min-width: 1100px) {     .masonry {         -moz-column-count: 2;         -webkit-column-count: 2;         column-count: 2;     } }  @media screen , (min-width: 1280px) {     .wrapper {         width: 1260px;     } } </style>   <style> body { margin: 0; } .labs-header { text-decoration: none; display: inline-block; vertical-align: middle; padding: 1em 2em; } .labs-header, .labs-header { color: rgba(0, 0, 0, .5); } .labs-header a:hover { color: rgba(0, 0, 0, .75); } .labs-header.dark, .labs-header.dark { color: rgba(255, 255, 255, .5); } .labs-header.dark a:hover { color: rgba(255, 255, 255, .75); } </style>  </head>  <body> <header class="labs-header"> </header>  <div class="demo-wrap"> <div class="wrapper"> <div class="title"><h1>responsive css masonry</h1></div>  <div class="masonry"> <div class="item">hello, really really really really really really really long sentence.</div> <div class="item"><iframe width="560" height="315" src="https://www.youtube.com/embed/c5nblcuigiu" frameborder="0" allowfullscreen></iframe></div> <div class="item">hello!</div> <div class="item"><img src="http://sites.psu.edu/siowfa14/wp-content/uploads/sites/13467/2014/10/female-red-eyed-tree-frog-tree-frogs-11755689-600-426.jpg"></div> </div>  </body>  </html> 

thanks help...

solved it. had remove following piece of code:

img, iframe { max-width: 100%; height: auto; display: block; } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -