[英]How can I make an image bar to stay on top with the menu on mobile?
I have downloaded the HTML5 template from http://html5up.net/prologue . 我已经从http://html5up.net/prologue下载了HTML5模板。 The template is responsive, and the navigation menu stays on top in mobile to be clicked to show the menu items.
模板是响应式的,导航菜单位于移动设备的顶部,可以单击以显示菜单项。 What I am trying to achieve is to include the image at top that would stay fixed like the menu in the mobile view.
我要实现的目标是在顶部保留像移动视图中的菜单一样固定的图像。 I have tried adding a div as below:
我试过添加div如下:
<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index:99;">
<img src="nameofimagefile"/>
</div>
But I am not able to achieve what I need. 但是我无法实现我所需要的。 The image stays on top but blocks or hides the menu items.
图像停留在顶部,但阻止或隐藏菜单项。 Could you help me in achieving this?
你能帮我实现这个目标吗?
The following images may make it clear on what I am trying to achieve: 下图可以清楚地说明我要实现的目标:
Present Website: 现在的网站:
What I Would Like: 我想要的是:
If you want it works only on a narrow screen do this: 如果您希望它仅在窄屏上运行,请执行以下操作:
In /js/init.js file find sidePanelToggle object and add to its html property your div with buttons 在/js/init.js文件中,找到sidePanelToggle对象,然后使用按钮将div添加到其html属性中
// ...
sidePanelToggle: {
breakpoints: 'narrower',
position: 'top-left',
side: 'top',
height: '4em',
width: '5em',
html: '<div data-action="toggleLayer" data-args="sidePanel" class="toggle"></div>' + '<div style="position: fixed; display: inline; top: 0; right: 5px; color: white">Your buttons here</div>'
// ...
change the 改变
#main section.cover {
padding: 0; /*for all the @media css*/
}
and then add image tag before the h2 tag within header tag 然后在标题标签中的h2标签之前添加图片标签
It will work ! 会工作的!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.