当前位置:网站首页>Determine the best implementation of horizontal and vertical screens
Determine the best implementation of horizontal and vertical screens
2022-07-05 20:55:00 【CV engineer with brain】
1、CSS Media Queries
1. inline style
@media screen and (orientation:portrait) {
// Vertical screen
}
@media screen and (orientation:landscape) {
// Horizontal screen
}
2. Outreach style
<!-- Vertical screen -->
<link rel="stylesheet" media="all and (orientation:portrait)" href="..." />
<!-- Horizontal screen -->
<link rel="stylesheet" media="all and (orientation:landscape)" href="..." />
3.window.matchMedia()
var mql = window.matchMedia("(orientation: portrait)");
function onMatchMeidaChange(mql){
if(mql.matches) {
// Vertical screen
}else {
// Horizontal screen
}
}
onMatchMeidaChange(mql);
mql.addListener(onMatchMeidaChange);
4.window.innerHeight/window.innerWidth
function detectOrient(){
if(window.innerHeight >= window.innerWidth) {
// Vertical screen
}else {
// Horizontal screen
}
}
detectOrient();
window.addEventListener('resize',detectOrient);
边栏推荐
- Binary search
- Prior knowledge of machine learning in probability theory (Part 1)
- Abnova fluorescent dye 620-m streptavidin scheme
- Analyze the knowledge transfer and sharing spirit of maker Education
- Is Kai Niu 2980 useful? Is it safe to open an account
- ts 之 属性的修饰符public、private、protect
- Viewrootimpl and windowmanagerservice notes
- Duchefa丨D5124 MD5A 培养基中英文说明书
- Abnova丨培养细胞总 RNA 纯化试剂盒中英文说明书
- 线程池的使用
猜你喜欢

Open source SPL eliminates tens of thousands of database intermediate tables

Abnova丨E (DIII) (WNV) 重组蛋白 中英文说明书

培养机器人教育创造力的前沿科技

研学旅游实践教育的开展助力文旅产业发展

PHP deserialization +md5 collision

Make Jar, Not War

Duchefa丨MS培养基含维生素说明书

中国的软件公司为什么做不出产品?00后抛弃互联网;B站开源的高性能API网关组件|码农周刊VIP会员专属邮件周报 Vol.097

Typhoon is coming! How to prevent typhoons on construction sites!
MySQL fully parses json/ arrays
随机推荐
Viewrootimpl and windowmanagerservice notes
When steam education enters personalized information technology courses
Abnova CD81 monoclonal antibody related parameters and Applications
Is it necessary for bazel to learn
Écrire une interface basée sur flask
示波器探头对测量带宽的影响
Abnova e (diii) (WNV) recombinant protein Chinese and English instructions
Hdu2377bus pass (build more complex diagram +spfa)
AITM2-0002 12s或60s垂直燃烧试验
AITM 2-0003 水平燃烧试验
EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
mysql全面解析json/数组
ProSci LAG-3 重组蛋白说明书
如何让化工企业的ERP库存账目更准确
请查收.NET MAUI 的最新学习资源
leetcode:1755. 最接近目标值的子序列和
基于flask写一个接口
木板ISO 5660-1 热量释放速率摸底测试
判断横竖屏的最佳实现
Abnova丨 MaxPab 小鼠源多克隆抗体解决方案