当前位置:网站首页>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);
边栏推荐
- 清除app data以及获取图标
- Duchefa丨P1001植物琼脂中英文说明书
- 启牛2980有没有用?开户安全吗、
- sql系列(基础)-第二章 限制和排序数据
- Duchefa s0188 Chinese and English instructions of spectinomycin hydrochloride pentahydrate
- PHP deserialization +md5 collision
- Simple getting started example of Web Service
- 概率论机器学习的先验知识(上)
- Écrire une interface basée sur flask
- ODPs next map / reduce preparation
猜你喜欢
Use of thread pool
示波器探头对测量带宽的影响
Typhoon is coming! How to prevent typhoons on construction sites!
基於flask寫一個接口
Duchefa MS medium contains vitamin instructions
解析五育融合之下的steam教育模式
Abbkine BCA法 蛋白质定量试剂盒说明书
Abnova丨血液总核酸纯化试剂盒预装相关说明书
Mathematical analysis_ Notes_ Chapter 9: curve integral and surface integral
Open source SPL eliminates tens of thousands of database intermediate tables
随机推荐
Research and development efficiency improvement practice of large insurance groups with 10000 + code base and 3000 + R & D personnel
Analyze the knowledge transfer and sharing spirit of maker Education
Abnova丨荧光染料 620-M 链霉亲和素方案
清除app data以及获取图标
leetcode:1755. 最接近目标值的子序列和
国外LEAD美国简称对照表
大二下个人发展小结
Open source SPL eliminates tens of thousands of database intermediate tables
Prosci LAG-3 recombinant protein specification
CADD course learning (7) -- Simulation of target and small molecule interaction (semi flexible docking autodock)
基于flask写一个接口
Abnova cyclosporin a monoclonal antibody and its research tools
Material Design组件 - 使用BottomSheet展现扩展内容(二)
MySQL fully parses json/ arrays
hdu2377Bus Pass(构建更复杂的图+spfa)
Abnova丨CRISPR SpCas9 多克隆抗体方案
MySQL InnoDB架构原理
Abnova e (diii) (WNV) recombinant protein Chinese and English instructions
Simple getting started example of Web Service
2. < tag hash table, string> supplement: Sword finger offer 50 The first character DBC that appears only once