resize youtube with div size
Dear All
I am developing a website
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
- //newsvideojsonfill.php
- session_start();
-
- include_once("includes/dbconnect.php");
- include_once("includes/config.inc.php");
-
-
- $sql = mysql_query("select * from newsvideo where id='".intval($_REQUEST['id'])."'");
- // echo mysql_num_rows($sql);
- if(mysql_num_rows($sql))
- {
- $data = mysql_fetch_array($sql);
- echo json_encode($data);
-
- }
Code to display div in center
- jQuery(document).ready(function ($) { // a local $ will protect you from nasty plugins calling .noConflict
-
-
- $.fn.center = function () {
- this.css("position","absolute");
-
-
- this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
- $(window).scrollTop()) + "px");
- this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
- $(window).scrollLeft()) + "px");
- return this;
- }
-
-
- $('#samplevideodiv').center();
-
- });
-
-
- $(window).resize(function () {
- $('#samplevideodiv').center();
- });
-
Code for youtube
I am getting 90% width
but i am not getting 85% height