博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c++98 使用指针指针_在媒体查询中使用指针事件
阅读量:2516 次
发布时间:2019-05-11

本文共 2078 字,大约阅读时间需要 6 分钟。

c++98 使用指针指针

We all know that there are a number of ways we can modify layout based on CSS media queries -- hell, we can even . One bit of outside the box thinking with media queries is deals with . Using the pointer-events property, we can also enable and disable some functionality with CSS based on media query state!

我们都知道,有很多方法可以基于CSS媒体查询来修改布局-地狱,我们甚至可以 。 与媒体查询无关紧要的一点是处理 。 使用pointer-events属性,我们还可以基于媒体查询状态启用和禁用CSS的某些功能!

The scenario is one that's present in the current implementation of the MDN redesign. On the left you see article content, on the right you see a table of contents:

该方案是MDN重新设计当前实施中的一种方案。 在左侧,您可以看到文章的内容,在右侧,您可以看到一个目录:

MDN Redesign Desktop

When pushed into the tablet media query, the table of contents should move above the content:

当推入数位板媒体查询时,目录应移至内容上方:

MDN Redesign Tablet

When on desktop, the table of contents should not be toggleable when the title is clicked. On tablet or other mobile device, however, the table of contents should toggle (slide up) when clicked to free up critical space, so as to avoid (possibly) loads of scrolling. I didn't want to use JavaScript to enable/disable the toggler, because...well...that would be inefficient. Instead I paired the pointer-events property with the tablet media query:

在桌面上时,单击标题时目录不可切换。 但是,在平板电脑或其他移动设备上,单击目录时应切换(向上滑动)以释放关键空间,以避免(可能)避免滚动负荷。 我不想使用JavaScript启用/禁用切换器,因为...好吧...那会很低效。 相反,我将pointer-events属性与平板电脑媒体查询配对:

/* disable by default */#toc .heading {	pointer-events: none;}#toc i {	display: none;}/* enable for tablet! */@media only screen and (max-width: 760px) {	#toc .heading {		pointer-events: auto;	}	#toc i {		display: block;	}	}

I absolutely adore pointer-events because it even prevents click events from firing, thus the JavaScript I use to trigger the doesn't occur. While I wouldn't say what I've done is overly clever, I would like to say that you should think about modifying more than just layout within different media queries. Oh, and also, pointer-events is awesome!

我绝对喜欢pointer-events因为它甚至可以防止触发click事件,因此不会使用用于触发JavaScript。 尽管我不会说我所做的事情过于聪明,但我想说的是,您应该考虑修改的内容不只是在不同媒体查询中的布局。 哦, pointer-events真棒!

翻译自:

c++98 使用指针指针

转载地址:http://uvpwd.baihongyu.com/

你可能感兴趣的文章
css规范 - bem
查看>>
电梯调度程序的UI设计
查看>>
转自 zera php中extends和implements的区别
查看>>
Array.of使用实例
查看>>
【Luogu】P2498拯救小云公主(spfa)
查看>>
如何获取网站icon
查看>>
几种排序写法
查看>>
java 多线程的应用场景
查看>>
dell support
查看>>
转:Maven项目编译后classes文件中没有dao的xml文件以及没有resources中的配置文件的问题解决...
查看>>
MTK android 设置里 "关于手机" 信息参数修改
查看>>
单变量微积分笔记6——线性近似和二阶近似
查看>>
补几天前的读书笔记
查看>>
HDU 1829/POJ 2492 A Bug's Life
查看>>
CKplayer:视频推荐和分享插件设置
查看>>
CentOS系统将UTC时间修改为CST时间
查看>>
redis常见面试题
查看>>
导航控制器的出栈
查看>>
玩转CSS3,嗨翻WEB前端,CSS3伪类元素详解/深入浅出[原创][5+3时代]
查看>>
iOS 9音频应用播放音频之播放控制暂停停止前进后退的设置
查看>>