当前位置:网站首页>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);
边栏推荐
猜你喜欢
随机推荐
Interpreting the daily application functions of cooperative robots
Abnova total RNA Purification Kit for cultured cells Chinese and English instructions
Research and development efficiency improvement practice of large insurance groups with 10000 + code base and 3000 + R & D personnel
ClickHouse 复制粘贴多行sql语句报错
bazel是否有学习的必要
请查收.NET MAUI 的最新学习资源
Abnova 环孢素A单克隆抗体,及其研究工具
Popular science | does poor English affect the NPDP exam?
Open source SPL eliminates tens of thousands of database intermediate tables
Monorepo管理方法论和依赖安全
Abnova丨 CD81单克隆抗体相关参数和应用
学习机器人无从下手?带你体会当下机器人热门研究方向有哪些
Écrire une interface basée sur flask
当Steam教育进入个性化信息技术课程
systemd-resolved 开启 debug 日志
leetcode:1755. 最接近目标值的子序列和
Use of form text box (II) input filtering (synthetic event)
Duchefa MS medium contains vitamin instructions
Make Jar, Not War
matplotlib绘图润色(如何形成高质量的图,例如设如何置字体等)









