当前位置:网站首页>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);
边栏推荐
- Comparison table of foreign lead American abbreviations
- AI automatically generates annotation documents from code
- 台风来袭!建筑工地该如何防范台风!
- Abnova fluorescent dye 620-m streptavidin scheme
- The development of research tourism practical education helps the development of cultural tourism industry
- Abnova丨 CD81单克隆抗体相关参数和应用
- Return to blowing marshland -- travel notes of zhailidong, founder of duanzhitang
- Careercup its 1.8 serial shift includes problems
- 序列联配Sequence Alignment
- Analysis of steam education mode under the integration of five Education
猜你喜欢
解读协作型机器人的日常应用功能
显示屏DIN 4102-1 Class B1防火测试要求
Duchefa d5124 md5a medium Chinese and English instructions
AI automatically generates annotation documents from code
Duchefa细胞分裂素丨二氢玉米素 (DHZ)说明书
The development of research tourism practical education helps the development of cultural tourism industry
基于AVFoundation实现视频录制的两种方式
Abnova丨血液总核酸纯化试剂盒预装相关说明书
Promouvoir le développement de l'industrie culturelle et touristique par la recherche, l'apprentissage et l'enseignement pratique du tourisme
Graph embedding learning notes
随机推荐
基於flask寫一個接口
How to renew NPDP? Here comes the operation guide!
手机开户股票开户安全吗?我家比较偏远,有更好的开户途径么?
AITM 2-0003 水平燃烧试验
Web Service简单入门示例
Selenium element information
Duchefa细胞分裂素丨二氢玉米素 (DHZ)说明书
LeetCode: Distinct Subsequences [115]
Monorepo management methodology and dependency security
解析创客教育的知识迁移和分享精神
Matplotlib drawing retouching (how to form high-quality drawings, such as how to set fonts, etc.)
[UE4] unrealinsight obtains the real machine performance test report
Abnova丨DNA 标记高质量控制测试方案
matplotlib绘图润色(如何形成高质量的图,例如设如何置字体等)
Is Kai Niu 2980 useful? Is it safe to open an account
Duchefa d5124 md5a medium Chinese and English instructions
ODPS 下一个map / reduce 准备
PHP deserialization +md5 collision
Abnova CRISPR spcas9 polyclonal antibody protocol
Go file path operation