Sublime视频播放器未在IE9中调整大小

时间:2012-04-12 15:14:29

标签: jquery css html5 video html5-video

所以我使用这个托管的js来运行我的视频:http://sublimevideo.net/

在第一张幻灯片上:www.xsp.com/indexvideo.php

链接应该显示一个隐藏的div,它有一个容器。当您单击视频时,它应该填充页眉和页脚之间的空格。它做的。在调整浏览器窗口大小时,还应调整视频大小。适用于IE 7 + 8,Firefox和Safari。但不是IE 9。

有人有任何想法吗?

调整要遵循的代码:

    $(window).resize(function() {
        proportion_index();
        clearTimeout(resizeTimer);
        resizeTimer = setTimeout(letsDoThis, 0);
    });

    function letsDoThis() {
        resize_object();
    };

    function resize_object() {
        var viewportwidth;
        var viewportheight;

        // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
        if (typeof window.innerWidth != 'undefined') {
            viewportwidth = window.innerWidth;
            viewportheight = window.innerHeight;
        }

        // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
        else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth != 0) {
            viewportwidth = document.documentElement.clientWidth;
            viewportheight = document.documentElement.clientHeight;
        }

        // older versions of IE
        else {
            viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
            viewportheight = document.getElementsByTagName('body')[0].clientHeight;
        }

        //SET THE VIEWPORT TO BROWSER WIDTH AND BROWSER HEIGHT MINUS THE HEADER AND FOOTER SPACE
        if(viewportheight > 650) {
            viewportheight = viewportheight - 242;
        } else if(viewportheight <= 650) {
            viewportheight = viewportheight - 90;
        }

        $('#slide1video').css('width',viewportwidth);
        $('#slide1video').css('height',viewportheight);
        $('#slide1video').css('z-index','1001');
        $('#slide1video').css('background','#000000');

        $('#sublime_video_wrapper_0').css('width',viewportwidth);
        $('#sublime_video_wrapper_0').css('height',viewportheight);
        $('#sublime_video_wrapper_0').css('z-index','1002');
        $('#slide1video').css('background','#000000');

        $('span.sv_play_button').css('width',viewportwidth);
        $('span.sv_play_button').css('height',viewportheight);
        $('span.sv_play_button').css('background','blue');
        $('span.sv_play_button').css('z-index','1003');

        $('.sublime_video_content').css('width',viewportwidth);
        $('.sublime_video_content').css('height',viewportheight);
        $('.sublime_video_content').css('background','#000000');

        $('video.sublimed').attr('width',viewportwidth);
        $('video.sublimed').attr('height',viewportheight);
        $('video.sublimed').css('width',viewportwidth);
        $('video.sublimed').css('height',viewportheight);
        $('video.sublimed').css('max-width',viewportwidth);
        $('video.sublimed').css('max-height',viewportheight);
        $('video.sublimed').css('left','0');
        $('video.sv_html5_fullscreen').css('left','0');
        $('video.sublimed').css('z-index','1000');

        $('.sv_controls').css('width',viewportwidth);
        $('.sv_progress_back').css('width',viewportwidth - 89);
    }

1 个答案:

答案 0 :(得分:2)

您应该尝试使用SublimeVideo调整大小方法,而不是手动执行。在此处查找演示:http://test.sublimevideo.net/resize以及有关我们文档中调整大小方法的更多信息:http://docs.sublimevideo.net/javascript-api/methods#resize

不要犹豫,在我们的社区论坛中提出任何问题。