0

所以我使用这个托管的 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);
    }
4

1 回答 1

2

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

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

于 2012-04-12T16:41:41.703 回答