- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试在我正在处理的网站的页脚中创建一个下拉式垂直导航。它有点适用于台式机。 But on the iPhone I'm testing the media query, when a sublink is selected, it choose the main link "below"it and opens up that link's submenu.我的 HTML CSS 和 JS 如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<meta charset="UTF-8" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="wrapper">
<div id="sidebar">
</div>
<div id="main">
<div id="content">
<div id="header">
<nav id="headernav">
<ul>
<li><a href="#about">| About |</a>
<ul>
<li><a href="mission/">Mission Statement</a></li>
<li><a href="#history">History</a>
<ul>
<li><a href="first50/">First 50 Years</a></li>
<li><a href="next20/">Last 20 Years</a></li>
<li><a href="recent/">2002 - Present</a></li>
</ul>
</li>
<li><a href="districts_map.pdf">District Map</a></li>
<li><a href="board/">Board of Directors</a></li>
</ul>
</li>
<li><a href="#members"> Members |</a>
<ul>
<li><a href="benefits/">Member Benefits</a></li>
<li><a href="section/">Member Section</a></li>
<li><a href="jobbank.iphtml">Job Bank</a></li>
<li><a href="#newsletter">Newsletter</a>
<ul>
<li><a href="summer/">Current Issue</a></li>
<li><a href="newsletters/">Archived Issue</a></li>
</ul>
</li>
<li><a href="bylaws.doc">Bylaws</a>
<li><a href="members/">Sign In</a></li>
<li><a href="dues/index.iphtml">Pay Dues</a></li>
<li><a href="forgotten_password.iphtml">Password Recovery</a></li>
<li><a href="addresschange.iphtml">Change my Contact Information</a></li>
<li><a href="links/">Links to Other Subspecialty Groups</a></li>
</ul>
</li>
<li><a href="#join"> Join |</a>
<ul>
<li><a href="benefits/">Member Benefits</a></li>
<li><a href="join.pdf">Membership Application</a></li>
</ul>
</li>
<li><a href="#news"> Legislative News |</a>
<ul>
<li><a href="resources/">Resources</a></li>
<li><a href="other.iphtml">Other</a></li>
</ul>
</li>
<li><a href="#meetings"> Meetings |</a>
<ul>
<li><a href="upcoming/">Upcoming</a>
<li><a href="past/">Past</a>
<li><a href="exhibitors.iphtml">Exhibitors</a>
</ul>
</li>
<li><a href="findadoc/"> Find A Doc |</a></li>
</ul>
</nav>
<br /><br /><br /><br />
</div>
<!-- Page Content -->
<div id="mobilenavlink">Click <a href="#mnav">here</a> for site navigation</div>
<hr>
<div id="footer">
<br />
<p style="visibility:hidden;"><a id="mnav">Site Navigation</a></p>
<div id="footer">
<br />
<p style="visibility:hidden;"><a id="mnav">Site Navigation</a></p>
<div id="header2">
<nav id="mobilenav" role="navigation">
<a href="#mobilenav" title="Show navigation">Show navigation</a>
<a href="#" title="Hide navigation">Hide navigation</a>
<ul>
<li><a href="?about"> About </a>
<ul>
<li><a href="mission/">Mission Statement</a></li>
<li><a href="?history">History</a>
<ul>
<li><a href="first50/">First 50 Years</a></li>
<li><a href="last20">Last 20 Years</a></li>
<li><a href="recent/">2002 - Present</a></li>
</ul>
</li>
<li><a href="map.pdf">District Map</a></li>
<li><a href="board/">Board of Directors</a></li>
</ul>
</li>
<li><a href="?members"> Members </a>
<ul>
<li><a href="benefits/">Member Benefits</a></li>
<li><a href="member_section.iphtml">Member Section</a></li>
<li><a href="jobbank.iphtml">Job Bank</a></li>
<li><a href="?newsletter">Newsletter</a>
<ul>
<li><a href="summer/">Current</a></li>
<li><a href="newsletters/">Archived</a></li>
</ul>
</li>
<li><a href="bylaws.doc">Bylaws</a>
<li><a href="members/">Sign In</a></li>
<li><a href="dues/index.iphtml">Pay Dues</a></li>
<li><a href="forgotten_password.iphtml">Password Recovery</a></li>
<li><a href="addresschange.iphtml">Change Account</a></li>
<li><a href="links/">Subspecialty Groups</a></li>
</ul>
</li>
<li><a href="?join"> Join </a>
<ul>
<li><a href="benefits/">Member Benefits</a></li>
<li><a href="join.pdf">Membership Application</a></li>
</ul>
</li>
<li><a href="?news"> Legislative News </a>
<ul>
<li><a href="resources/">Resources</a></li>
<li><a href="Orthe.iphtml">Other</a></li>
</ul>
</li>
<li><a href="?meetings"> Meetings </a>
<ul>
<li><a href="upcoming/">Upcoming</a>
<li><a href="past/">Past</a>
<li><a href="exhibitors.iphtml">Exhibitors</a>
</ul>
</li>
<li><a href="findadoc/"> Find A Doc </a></li>
</ul>
</nav>
</div>
</div></div>
<script src="jquery.js"></script>
<script src="doubletaptogo.js"></script>
<script>
$( function()
{
$( '#mobilenav li:has(ul)' ).doubleTapToGo();
});
</script>
</body>
</html>
CSS:
body {
font-family: arial, sans-serif;
text-align: left;
background-color: #000000;
background-image: url(./images/background.jpg);
background-repeat: repeat-y;
margin-top: 10px;
margin-bottom: 10px;
}
table {
background-color: #ffffff;
border:double;
border-width:4px;
border-collapse:collapse;
max-width:100%;
}
p {
/* text-align: left; */
font-family: arial, sans-serif;
}
em {
/* text-align: left; */
font-family: arial, sans-serif;
}
li {
/* text-align: left; */
font-family: arial, sans-serif;
}
hr {
/* visibility:hidden; */
}
img {
max-width:100%;
height:auto;
}
/*MAIN THEME COMPONENTS*/
#wrapper {
display: block;
/* border: 1px #a2a2a2 solid; */
width: auto;
margin: 0;
padding: 0 15px;
}
#header {
width:auto;
margin-left: auto;
margin-right: auto;
/* margin-left: 230px;
margin-right: 0; */
}
#mobilenavlink{
display:none;
}
#main {
margin: 10px auto 0 210px;
background-color: white;
border: ridge 4px;
border-radius: 4px;
width: auto;
}
#content {
width: auto;
padding: 2%;
}
#content img{
border:0;
}
#sidebar {
float:left;
width: 190px;
color: white;
font: bold 2em;
margin-top: 0;
}
#sidebar img{
border:0;
}
#delimiter {
clear: both;
}
#footer {
width: auto;
background-color: #28377a;
color: white;
}
/*ORIGINAL NAV STYLING FOR HEADER NAV */
#headernav {
font-size: 20px;
white-space:nowrap;
float:left;
margin-right:-999em;
}
#headernav ul ul {
display: none;
}
#headernav ul li:hover > ul {
display: block;
}
#headernav ul {
background: #22629e;
background: linear-gradient(to bottom, #CCE2F5, #22629e);
/* background: -ms-linear-gradient(top, #CCE2F5 0%,#22629e 60%); */
background: -moz-linear-gradient(top, #CCE2F5 0%, #22629e 60%);
background: -webkit-linear-gradient(top, #CCE2F5 0%,#22629e 60%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 5px;
border-radius: 4px;
list-style: none;
position: relative;
display: inline-table;
}
#headernav ul:after {
content: "";
clear: both;
display: block;
}
#headernav ul li {
float: left;
}
#headernav ul li:hover {
background: #194976;
background: linear-gradient(top, #22629e 0%, #112F4B 40%);
background: -moz-linear-gradient(top, #22629e 0%, #112F4B 100%);
background: -webkit-linear-gradient(top, #22629e 0%,#112F4B 40%);
}
#headernav ul li:hover a {
color: #ffffff;
}
#headernav ul li a {
display: block;
padding: 5px 0px;
color: #eeeeee;
text-decoration: none;
}
#headernav ul ul {
background: #112F4B;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
#headernav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
#headernav ul ul li a {
padding: 5px 5px;
color: #fff;
}
#headernav ul ul li a:hover {
background: #112F4B;
background: linear-gradient(top, #22629e 0%, #112F4B 100%);
background: -moz-linear-gradient(top, #22629e 0%, #112F4B 100%);
background: -webkit-linear-gradient(top, #22629e 0%,#112F4B 100%);
}
#headernav ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
/*NEW NAV STYLING FOR MOBILE/FOOTER NAV */
#mobilenav {
font-size: 20px;
white-space:nowrap;
float:left;
margin-right:-999em;
}
#mobilenav ul ul {
display: none;
}
#mobilenav ul li:hover > ul {
display: block;
}
#mobilenav ul {
background: #22629e;
padding: 0 5px;
list-style: none;
position: relative;
display: inline-table;
}
#mobilenav ul:after {
content: "";
clear: both;
display: block;
}
#mobilenav ul li {
float: left;
}
#mobilenav ul li:hover {
background: #194976;
background: linear-gradient(top, #22629e 0%, #112F4B 40%);
background: -moz-linear-gradient(top, #22629e 0%, #112F4B 100%);
background: -webkit-linear-gradient(top, #22629e 0%,#112F4B 40%);
}
#mobilenav ul li:hover a {
color: #ffffff;
}
#mobilenav ul li a {
display: block;
padding: 5px 0px;
color: #eeeeee;
text-decoration: none;
}
#mobilenav ul ul {
background: #112F4B;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
#mobilenav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
#mobilenav ul ul li a {
padding: 5px 5px;
color: #fff;
}
#mobilenav ul ul li a:hover {
background: #112F4B;
background: linear-gradient(top, #22629e 0%, #112F4B 100%);
background: -moz-linear-gradient(top, #22629e 0%, #112F4B 100%);
background: -webkit-linear-gradient(top, #22629e 0%,#112F4B 100%);
}
#mobilenav ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
#mobilenav {
font-size: 20px;
white-space:nowrap;
}
#mobilenav ul ul {
display: none;
}
#mobilenav > a {
display: none;
}
#mobilenav li {
position: relative;
}
/* first level */
/*COMMENTING ORIGINAL MOBILE NAV CODE
#mobilenav > ul {
/* height: 3.75em; */
}
/*COMMENTING ORIGINAL MOBILE NAV CODE
#mobilenav > ul > li {
width: 25%;
height: 100%;
float: left;
}
/* second level */
/*COMMENTING ORIGINAL MOBILE NAV CODE
#mobilenav li ul {
display: none;
position: absolute;
top: 100%;
}
#mobilenav li:hover ul {
display: block;
}*/
/*MEDIA QUERIES BELOW*/
@media only screen and (min-width : 320px) and (max-width : 480px) {
/* iPhone2G-4S */
#sidebar {
display: none;
}
#content {
width: auto;
padding: 2%;
margin-left: 0px;
}
#wrapper {
display: block;
width: auto;
margin: auto;
padding: 0 15px;
}
#main {
margin: 10px 0 0 10px;
background-color: white;
border: ridge 4px;
border-color: #5b2542;
width: auto;
}
#header2 {
width: auto;
margin-left: auto;
margin-right: auto;
position:relative;
display:block;
}
#header {
display:none;
}
#footer{
height:auto;
}
#mobilenavlink{
display:block;
}
/*MOBILE NAV TEST*/
#mobilenav {
display:block;
position: relative;
top: auto;
left: auto;
}
#mobilenav > a {
background-color: #e15a1f;
position: relative;
}
#mobilenav > a:before,
#mobilenav > a:after {
position: absolute;
border: 2px solid #fff;
content: '';
}
#mobilenav > a:after {
top: 60%;
}
#mobilenav:not( :target ) > a:first-of-type,
#mobilenav:target > a:last-of-type {
display: block;
}
/* first level */
#mobilenav > ul {
height: auto;
display: none;
position: absolute;
}
#mobilenav:target > ul {
display: block;
}
#mobilenav > ul > li {
width: 100%;
float: none;
}
#mobilenav > ul > li > a {
height: auto;
text-align: left;
}
#mobilenav > ul > li:not( :last-child ) > a{
border-right: none;
border-bottom: 1px solid #000000;
}
/* second level */
#mobilenav li ul {
position: static;
padding-top: 0;
}
/*END MOBILE NAV TEST*/
}
JS:
;(function( $, window, document, undefined )
{
$.fn.doubleTapToGo = function( params )
{
if( !( 'ontouchstart' in window ) &&
!navigator.msMaxTouchPoints &&
!navigator.userAgent.toLowerCase().match( /windows phone os 7/i ) )
return false;
this.each( function()
{
var curItem = false;
$( this ).on( 'click', function( e )
{
var item = $( this );
if( item[ 0 ] != curItem[ 0 ] )
{
e.preventDefault();
curItem = item;
}
});
$( document ).on( 'click touchstart MSPointerDown', function( e )
{
var resetItem = true,
parents = $( e.target ).parents();
for( var i = 0; i < parents.length; i++ )
if( parents[ i ] == curItem[ 0 ] )
resetItem = false;
if( resetItem )
curItem = false;
});
});
return this;
};
})( jQuery, window, document );
顶部的主标题按我希望的方式工作。但是我用于响应式导航的代码来自不同的样式,我不确定如何改进它。我已经编码了大约半年,所以我知道可能有更好的方法来做这些事情,如果我的代码充满了不必要的冗余,我提前道歉。谢谢。
编辑:如果有帮助,这里是该站点的链接: http://vos.societyhq.com/我应该补充一点,我将为其他屏幕宽度添加媒体查询,但我想从(旧的)iPhone 分辨率开始,并首先让它正常工作。
最佳答案
你在使用 JQuery 吗?
如果是这样,您只需在点击(或悬停)时调用函数并传递要展开的列表的 ID。
JQuery:
function showHideNav(elID){
$("#" + elID).toggle();
}
HTML
<li onclick="showHideNav(dropdown1)">about
<ul id="dropdown1">
...
</ul>
</li>
关于javascript - 响应式导航在移动设备上的表现不尽如人意,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18514325/
只是想知道 Jquery Mobile 是否足够稳定以用于实时生产企业移动应用程序。 有很多 HTML5 框架,因为我们的团队使用 JQuery 已经有一段时间了,我们更愿意使用 Jquery 移动框
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 3 年前。 Improve t
所以我尝试在 JavaScript 中对元素进行拖放。我使用的视频教程在这里; https://www.youtube.com/watch?v=KTlZ4Hs5h80 。我已经按照它的说明进行了编码,
无法在移动 iOS(safari 和 chrome)上自动播放以前缓存的 mp3 音频 我正在 Angular 8 中开发一个应用程序,在该应用程序的一部分中,我试图在对象数组中缓存几个传入的音频 m
Git 基于内容而不是文件,所以我目前理解以下行为,但我想知道是否有特殊选项或 hack 来检测此类事情: git init mkdir -p foo/bar echo "test" foo/a.tx
我正在寻找语义 ui 正确的类来隐藏例如移动 View 中的 DIV。在 Bootstrap 中,我们有“visible-xs”和“hidden-xs”。 但是在语义ui上我只找到了“仅移动网格” 最
我正在使用 ubuntu 和 想要移动或复制大文件。 但是当我与其他人一起使用服务器时,我不想拥有所有内存并使其他进程几乎停止。 那么有没有办法在内存使用受限的情况下移动或复制文件? 最佳答案 如果你
这些指令有什么区别?以 ARM9 处理器为例,它不应该是: ASM: mov r0, 0 C: r0 = 0; ASM: ld r0, 0 C: r0 = 0; ? 我不知道为什么要使用一个或另一个:
我有一个文件夹,其中包含一些随机命名的文件,其中包含我需要的数据。 为了使用数据,我必须将文件移动到另一个文件夹并将文件命名为“file1.xml” 每次移动和重命名文件时,它都会替换目标文件夹中以前
我经常在 IB/Storyboard 中堆叠对象,几乎不可能拖动其他对象后面的对象而不移动前面的对象。无论如何我可以移动已经选择但位于其他对象后面的对象吗?当我尝试移动它时,它总是选择顶部的对象,还是
几个月前,我看到 Safari 7 允许推送通知,它似乎是一个非常有用的工具,除了我看到的每个示例都专注于桌面浏览,而不是移动设备。 Safari 推送通知是否可以在移动设备上运行,如果没有,是否有计
我有一个简单的 View 模型,其中包含修改后的 ObservableCollection使用 SynchronizationContext.Current.Send在 UI 线程上执行对集合的更改。
关于cassandra创建的数据文件和系统文件的位置,我需要移动在“cassandra.yaml”配置文件中设置的“commitlog_directory”、“data_file_directorie
我有这个代码 $(function() { var message = 'Dont forget us'; var original; var txt1 = ' - '; $(wind
我的客户报告说他的网站有一个奇怪的问题。该网站的 URL 是 your-montenegro.me 在 基于 Android 的浏览器 上加载时,页面底部会出现一个奇怪的空白区域。以下是屏幕截图: 华
我有这个 HTML 标记: Express 300 bsf Sign Up 我需要将元素从 DOM 上的一个
我有一个可重新排序的 TableView (UITableView 实例)。尽管我已经实现了 UITableViewDataSource 方法: tableView:moveRowAtIndexPat
我的客户报告说他的网站有一个奇怪的问题。该网站的 URL 是 your-montenegro.me 在 基于 Android 的浏览器 上加载时,页面底部会出现一个奇怪的空白区域。以下是屏幕截图: 华
我需要在拖放或复制/剪切和粘贴(复制与移动)期间获取操作类型。它是一个 Swing 应用程序,并且实现了 TransferHandle。我在操作结束时需要此信息,在 importData 方法中。 对
我编写了一个具有 add 和 get 方法的 SortedIntList 类。 我调用以下四个方法: SortedIntList mySortedIntList = new SortedIntList
我是一名优秀的程序员,十分优秀!