- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个包含导航元素的页面,我想将其隐藏在页面的左侧/右侧,并在我将鼠标悬停在图标上时显示。我在要隐藏的元素上使用 :after
伪元素创建了图标。该解决方案在经过测试的桌面浏览器上运行良好,但在 chrome 移动版上运行失败(即使桌面版本运行良好)。
我在 iOS 和 Android 上测试过,没有一个能够显示 :after
伪元素。 但是 如果您碰巧点击了:after
应该位于的位置,菜单就会显示出来。所以看起来这只是一个显示问题。
我创建了 this jsfiddle显示问题。我添加了一些 javascript 只是因为它在真实页面上,但我认为这不是问题的原因。
更奇怪的是,在 iOS 上,chrome 和 safari 都可以在 jsfiddle 上显示 M
和 S
,但在真实页面上无法显示图标。不过,Android 版 Chrome 也无法在 jsfiddle 上显示元素。
那么,我的问题是,如何在 Chrome 移动版或 iOS 浏览器上显示 :after
伪元素?
body, html {
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
background: white;
}
h1 {
text-align: center;
}
footer {
padding: 10px;
}
section {
background: white;
margin: 350px 0px 0px;
padding: 10px 10% 25px;
box-shadow: 0px 10px 20px rgba(120, 120, 120, 0.19), 0px -10px 10px rgba(150, 150, 150, 0.23);
overflow: hidden;
text-align: justify;
}
header div {
position: fixed;
text-align: center;
top: 0px;
left: 0px;
right: 0px;
z-index: -1;
}
header nav {
display: block;
position: fixed;
width: 60%;
top: 0px;
bottom: 0px;
right: 100%;
background: #BBBBBB;
color: #324353;
transition: all 0.8s ease-in-out;
z-index: 3;
overflow-y: auto;
}
header nav:hover {
right: 40%;
box-shadow: 15px 0px 20px rgba(100, 100, 100, 0.3);
}
header nav:after {
display: block;
position: fixed;
padding: 15px;
content: "M";
top: 0px;
left: 0px;
color: #324353;
transition: all 0.8s ease-in-out;
z-index: 4 !important;
}
header nav:hover:after {
visibility: hidden;
content: "x";
}
header aside {
display: block;
position: fixed;
width: 60%;
top: 0px;
bottom: 0px;
left: 100%;
background: #BBBBBB;
color: #324353;
transition: all 0.8s ease-in-out;
z-index: 3;
overflow-y: auto;
}
header aside:hover {
left: 40%;
box-shadow: -15px 0px 20px rgba(100, 100, 100, 0.3);
}
header aside:after {
display: block;
position: fixed;
padding: 15px;
content: "S";
top: 0px;
right: 0px;
color: #324353;
transition: all 0.8s ease-in-out;
z-index: 4 !important;
}
header aside:hover:after {
visibility: hidden;
content: "x";
}
<header>
<div>
<h1>
Some Title
</h1>
</div>
<nav>
Some Menu
</nav>
<aside>
Some Settings
</aside>
</header>
<section>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam id faucibus sem. Nullam venenatis arcu massa, sit amet sodales dui dapibus sit amet. Nunc est elit, feugiat a molestie a, eleifend vitae diam. Sed eleifend eros vel nunc cursus gravida. Nulla magna dolor, finibus non dolor a, auctor porta diam. Proin a justo ultrices, semper dolor sit amet, maximus leo. Proin vehicula tincidunt tortor, gravida pellentesque risus sollicitudin vel. Cras lacinia luctus tellus in consectetur. Morbi facilisis nec justo ut condimentum. In semper vestibulum libero, non vestibulum lacus efficitur sed. Proin laoreet convallis tristique. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec porta ligula odio, quis hendrerit nisl accumsan ac. Mauris aliquam cursus ultricies. Curabitur luctus, mi auctor bibendum interdum, mi arcu luctus lorem, at ornare nunc felis et lorem. Maecenas ut hendrerit arcu.
</section>
<footer>Some footer text</footer>
最佳答案
不确定移动浏览器发生了什么,但删除了 overflow-y: auto;
来自 header nav
和 header aside
似乎在工作。
但是,如果您确实需要滚动条,您可以将另一个元素(即 <ul>
)添加到 <nav>
中.
header nav ul {
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
padding: 0;
margin: 0;
overflow-y: auto;
}
参见 updated jsFiddle .
关于android - 伪元素 :after disapears on chrome mobile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35105527/
$.mobile.pageContainer 是指包含其他虚拟页面的元素。它设置为 .所以我认为它可以改变。实际上,某些 JQM 方法 (changePage) 允许您为页面指定非默认页面容器。 J
如何在移动设备上更改方向时触发事件。 调整大小 在 iPod Touch 上运行良好,但在使用 Opera mobile 作为浏览器的移动设备上运行良好。 有关如何在 Opera mobile 上触发
我想为我拥有的装有 Windows Mobile 2003 的设备开发一些应用程序,但我不想为此寻找 Visual Studio 2003 的副本。我想知道是否可以将 Mobile 6 SDK 用于此
我试图阻止 jQuery Mobile 在调用 changePage 时隐藏加载微调器。 程序流程是这样的,从点击一个链接开始,它的点击事件定义如下: $('body').delegate('.lib
我想为运行 Windows Mobile 5 的扫描仪开发应用程序。 MSDN 站点说要下载最新的 SDK(Windows Mobile 6 Professional SDK)。这会起作用还是我应该下
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我正在尝试使用 Jquery mobile 创建弹出菜单,通过单击按钮,它应该在不更改页面的情况下弹出菜单选项,类似于 jquery mobile 的选择菜单。在 JQM 中有没有办法做到这一点? 谢
在移动设备中,当我打开我的页面并选择一个输入框时,虚拟键盘打开,页面自动滚动以将输入框置于中心。 我不想要这个 Action 。 我搜索了很多答案,其中大多数建议在调整大小事件中手动调用以下 java
jQuery 移动列表中是否可以有多个拆分按钮? 我试过这样做: 1 但它不起作用。将链接包装在 中也不行.我做错了什么,
我想从我的 .js 文件中打开 .html 文件。所以我使用了 $.mobile.changePage("file.html")。在file.html 中有file.js。但是 file.js 在调用
我们有许多使用 Windows Mobile 6 的用户,需要应用较小的更改。例如。更新注册表设置。一种选择是使用我们的设备管理软件推送和执行可执行文件。 我希望这对熟悉 VBScript/JScri
我在PHP网站上有一个日期字段,并且我正在使用jQuery Mobile作为移动网站。 在移动浏览器(例如android上的firefox mobile)上浏览网站时,单击日期文本输入时,会出现日历对
我正在构建一个PhoneGap + JQuery Mobile应用程序,但似乎无法阻止它通过双击放大。我按照http://www.tricedesigns.com/2012/01/17/mobile-
随着 jQuery Mobile 1.3 的到来,.navigate()已添加功能。我听说这是更改页面的推荐方法,似乎他们解决了在页面之间传输数据的问题。 问题是,既然已经简化了,我该如何访问 cha
我想得到一个 input文本区域和 submit按钮附在它的右侧。 理想情况下,两者将使用 100% 的宽度并且并排放置。 我一直在尝试玩弄ui-grid-a和类似的选择,但一切都失败了。你可以看到一
我正在使用 jquery-mobile,我有这两个按钮: Pro: Reset 我希望它们并排显示(内联)。但我想不通。我做了this但它不起作用。你能帮我吗 ?这是我的 CSS:
我正在为 Windows Mobile 6.5 (Samsung Omnia II i8000) 开发 native 应用程序。进行一些更改后,我的应用程序在运行时挂起。 问题是我的应用程序也在启动期
有没有办法从周围和图标中删除背景光盘(圆圈)?我找到的光盘的唯一引用如下 background: rgba(0,0,0,.4) /*{global-ic
jQuery 移动版虽然在很多方面都很棒,但有时也令人沮丧。在这种情况下,我试图动态创建库中非常好的按钮之一。 基本上我想要做的是在输入字段中输入文本,当按下空格键时,它会创建一个带有文本的 jQue
我想在我的第 2 页上显示标题。使用以下内容是否有效: "> .... ? 最佳答案 这取决于你定义什么为“有效”
我是一名优秀的程序员,十分优秀!