繁体   English   中英

如何使用JavaScript更改页面方向?

[英]How to change page orientation using javascript?

我正在开发一个全屏视频网站。当用户使用智能手机访问该网站时,我想将页面方向更改为横向模式。 我尝试使用CSS媒体方向进行此操作,但没有锻炼。

请帮我使用javascript来工作。

您无法更改页面方向(您指的是设备吗?),只能检测到它(然后相应地修改样式)。

如何使用CSS旋转页面?

-webkit-transform:rotate(-90deg);
-moz-transform:rotate(-90deg);
-ms-transform:rotate(-90deg);
-o-transform:rotate(-90deg);
transform:rotate(-90deg);

如果您想更改pdf的方向,请说

var pdf = new BytescoutPDF();

pdf.pageSetOrientation(BytescoutPDF.PORTRAIT); // BytescoutPDF.PORTRAIT = portrait, BytescoutPDF.LANDSCAPE = landscape
    pdf.pageAdd();

    pdf.textAdd(50, 50, 'Portrait page orientation', 0);

    // add a page with landscape orientation
    pdf.pageSetOrientation(BytescoutPDF.LANDSCAPE);
    pdf.pageAdd();

    pdf.textAdd(50, 50, 'Landscape page orientation', 0);

    // return BytescoutPDF object instance
    return pdf;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM