[英]Responsive Mobile Menu - Jquery Toggle
I have created a responsive jquery mobile menu. 我创建了一个响应式jquery移动菜单。 The problem that I am having is the jquery coding by default hides the menu and only when the image is clicked the navigation expands.
我遇到的问题是默认情况下,jQuery编码会隐藏菜单,并且仅在单击图像时导航才会展开。 This functionality is fine except when being viewed on a desktop.
此功能很好,但在桌面上查看时除外。 Because it is set up by default to not appear it is not shown.
由于默认情况下它设置为不显示,因此不会显示。
I was hoping someone could help me to show the navigation on the desktop version and when a width threshold is crossed by default the navigation doesn't appear until it is clicked. 我希望有人能帮助我在桌面版本上显示导航,并且默认情况下超过宽度阈值时,直到单击导航后,导航才会出现。 This is so when someone visits the website on a mobile device the screen isn't covered with the menu.
这样,当有人通过移动设备访问网站时,菜单上不会覆盖屏幕。 I was also having problems retracting the menu when the image is pressed again.
再次按下图像时,我在收回菜单上也遇到了问题。
I have have uploaded my projected onto jsfiddle. 我已经将我的项目上传到jsfiddle上。
link
http://jsfiddle.net/bLbdavqu/ link
http://jsfiddle.net/bLbdavqu/
Thanks 谢谢
This can be achieved reasonable quickly and easily using Bootstrap. 使用Bootstrap可以合理,快速,轻松地实现这一目标。
http://getbootstrap.com/examples/navbar-fixed-top/ http://getbootstrap.com/examples/navbar-fixed-top/
http://getbootstrap.com/components/#navbar http://getbootstrap.com/components/#navbar
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
http://jsfiddle.net/rlgod/7d1szLkh/ http://jsfiddle.net/rlgod/7d1szLkh/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.