0

So I have this video tag, casual video tag with position fixed, top and left are set to 0px.

You can find the example here: http://stvdd.com/video/

I have this little script:

   $(document).ready(function() {
         $('#bgvideo').on("loadedmetadata", scaleVid);
            $(window).resize(function() {
                scaleVid();
            })

            function scaleVid(){
                if($(window).width()/$(window).height() > 1.7777777){

                    $('#bgvideo').css({
                        'width':$(window).width()
                    })
                }
                else
                    $('#bgvideo').css({
                        'height':$(window).height()
                    })
            }

        });

Here's the problem: when i resize just once or twice, it works. But when i resize really fast and just play with my window size, it bugs out. The video res is 16:9, hence the 1.77777 (I want it to maintain proportion)

4

1 に答える 1