Search code examples
javascriptyoutube-apiyoutube-javascript-apiscreen-sizebrowser-scrollbars

Changing Youtube Player Screen Size According to Browser's Window Size


If i use code below to get browser screen size there will be border and scroll bars. I want it to exactly get fitted to window no matter i open toolbars etc. I don't want border spaces and scroll bars. Neither horizontal nor vertical. Can you give me a clue to do it? By the way there is a demo and a screenshot below.

var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;

enter image description here


Solution

  • try resetting your css a little

     * html, body {margin: 0; padding:0;}
    

    this worked for me