resize youtube with div size

resize youtube with div size

Dear All

When clicked this on this blue colored Icon, a DIV is displayed
having a youtube video
   
My problem :
- Can I resize the youtube video with size of div ? if so how ?
  in short when my div size if big , the youtube should be big too
  and when its size (div size)  changes with  window size, the you tube size should also change
- the DIV is also not smartly resized 


I am using Json as 
  1. //newsvideojsonfill.php  
  2. session_start();
  3.  
  4.  include_once("includes/dbconnect.php");
  5. include_once("includes/config.inc.php");

  6.    
  7.         $sql = mysql_query("select * from newsvideo where id='".intval($_REQUEST['id'])."'");
  8.        // echo mysql_num_rows($sql);
  9.         if(mysql_num_rows($sql))
  10.         {
  11.           $data = mysql_fetch_array($sql);
  12.             echo json_encode($data);
  13.         
  14.         }
Code to display div in center

  1. jQuery(document).ready(function ($) { // a local $ will protect you from nasty plugins calling .noConflict

  2.  
  3. $.fn.center = function () {
  4. this.css("position","absolute");
  5.   
  6.  
  7.      this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + 
  8.                                                 $(window).scrollTop()) + "px");
  9.      this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + 
  10.                                                 $(window).scrollLeft()) + "px");
  11.     return this;
  12. }

  13.  
  14. $('#samplevideodiv').center();
  15.  
  16.    }); 


  17. $(window).resize(function () {
  18.     $('#samplevideodiv').center();
  19. });


Code for youtube
<iframe width="90%" height="85%" src=" https://www.youtube.com/embed/eyv-zYm2pwg" frameborder="0" allowfullscreen></iframe>

I am getting 90% width 
but i am not getting 85% height