当前位置:网站首页>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);
边栏推荐
- The development of research tourism practical education helps the development of cultural tourism industry
- CADD course learning (7) -- Simulation of target and small molecule interaction (semi flexible docking autodock)
- PHP deserialization +md5 collision
- How to make ERP inventory accounts of chemical enterprises more accurate
- 线程池的使用
- Interpreting the daily application functions of cooperative robots
- 序列联配Sequence Alignment
- LeetCode: Distinct Subsequences [115]
- Duchefa d5124 md5a medium Chinese and English instructions
- Web Service简单入门示例
猜你喜欢
Duchefa d5124 md5a medium Chinese and English instructions
示波器探头对信号源阻抗的影响
Duchefa丨S0188盐酸大观霉素五水合物中英文说明书
Open source SPL eliminates tens of thousands of database intermediate tables
phpstudy小皮的mysql点击启动后迅速闪退,已解决
Duchefa low melting point agarose PPC Chinese and English instructions
Graph embedding learning notes
leetcode:1139. 最大的以 1 为边界的正方形
Cutting edge technology for cultivating robot education creativity
Abnova丨CRISPR SpCas9 多克隆抗体方案
随机推荐
Duchefa d5124 md5a medium Chinese and English instructions
Prosci LAG-3 recombinant protein specification
Where is a good stock account? Is online account manager safe to open an account
2.<tag-哈希表, 字符串>补充: 剑指 Offer 50. 第一个只出现一次的字符 dbc
Clear app data and get Icon
Abnova DNA marker high quality control test program
NPDP如何续证?操作指南来了!
如何让化工企业的ERP库存账目更准确
AITM 2-0003 水平燃烧试验
使用WebAssembly在浏览器端操作Excel
ODPs next map / reduce preparation
启牛2980有没有用?开户安全吗、
ODPS 下一个map / reduce 准备
请查收.NET MAUI 的最新学习资源
When a user logs in, there is often a real-time drop-down box. For example, entering an email will @qq com,@163. com,@sohu. com
ts 之 泛型
重上吹麻滩——段芝堂创始人翟立冬游记
Abnova丨DNA 标记高质量控制测试方案
Comparison table of foreign lead American abbreviations
Abnova fluorescent dye 620-m streptavidin scheme