- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我的问题是关于当您将鼠标悬停在“打开按钮”上时滑入的菜单,它会将所有内容向下推,这是一个问题。它旨在打开图像,我无法弄清楚如何做到这一点。我过去曾尝试添加诸如 float 和更改位置标签之类的东西,但似乎没有任何效果。这是我的代码:
html,
body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-x: hidden;
}
#Bar {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 64px;
background-color: #592881
}
#logo {
position: relative;
top: -40px;
text-align: center;
left: 0;
right: 0;
z-index: 1;
}
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 100px;
left: 0;
background: rgba(89, 40, 129, .7);
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
text-align: center;
}
.sidenav a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: black;
display: block;
transition: 0.3s;
position: static;
}
.sidenav a:hover {
color: grey;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
@media screen and (max-height: 450px) {
.sidenav {
padding-top: 15px;
}
.sidenav a {
font-size: 18px;
}
}
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 3s;
animation-name: fade;
animation-duration: 3s;
}
@-webkit-keyframes fade {
from {
opacity: .4
}
to {
opacity: 1
}
}
@keyframes fade {
from {
opacity: .4
}
to {
opacity: 1
}
}
.container {
position: relative;
text-align: center;
}
.slides {
position: relative;
height: 100%;
vertical-align: middle;
margin-left: auto;
margin-right: auto;
}
.mySlides {
display: block;
left: 0;
right: 0;
max-width: 100%;
max-height: auto;
vertical-align: middle;
position: relative;
margin-left: auto;
margin-right: auto;
}
.prev,
.next {
cursor: pointer;
position: relative;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
}
.next {
float: right;
top: -500px;
border-radius: 3px 0 0 3px;
}
.prev {
left: 0px;
top: -500px;
border-radius: 3px 0 0 3px;
}
.prev:hover,
.next:hover {
background-color: rgba(0, 0, 0, 0.8);
}
.footer {
position: relative;
background-color: #F1F1F1;
color: #A8A8A8;
font-size: 18px;
padding-left: 400px;
}
.overlay {
float: left;
height: 70%;
width: 0;
position: relative;
z-index: 1;
top: 0;
left: 0;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.8);
overflow-x: hidden;
transition: .5s;
}
.overlay-content {
position: relative;
top: 25%;
width: 100%;
text-align: center;
margin-top: 30px;
padding-bottom: 30px;
}
.overlay a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #818181;
display: block;
transition: 0.3s;
}
.overlay a:hover,
.overlay a:focus {
color: #f1f1f1;
}
.overlay .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
}
@media screen and (max-height: 300px) {
.overlay a {
font-size: 20px
}
.overlay .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
.buttonContainer {
height: 3em;
width: 100%;
background-color: #ffffff;
}
<!DOCTYPE html>
<html>
<head>
<title>Masters of Engineering</title>
<link rel="stylesheet" type="text/css" href="C:\Users\Zach\Desktop\Coding\Robotics Site\css\Main.css">
<link rel="icon" href="img/Corner Logo.ico">
<meta charset="utf-8">
</head>
<body>
<div id="Bar"></div>
<div id="logo">
<img src="https://www.mastersny.org/uploaded/template/default/images/common/logo.png">
</div>
<script>
function openNav() {
document.getElementById("myNav").style.width = "100%";
}
function closeNav() {
document.getElementById("myNav").style.width = "0%";
}
</script>
<div class="buttonContainer">
<span style="margin-left:10%;font-size:30px;cursor:pointer; display: inline-block;" onmouseenter="openNav()" onmouseleave="closeNav()">☰open</span>
<span style="margin-left:10%;font-size:30px;cursor:pointer; position:relative; display:inline-block;" onmouseover="openNav();" onmouseout="closeNav();">☰open</span>
</div>
<div id="myNav" class="overlay" onmouseleave="closeNav()" onmouseenter="openNav()">
<div class="overlay-content">
<a href="#">about</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
</div>
<div id="myNav" class="overlay" onmouseleave="closeNav()" onmouseenter="openNav()">
<div class="overlay-content">
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
</div>
<div class='slideshow'>
<div class="slides">
<img class="mySlides fade" src="https://wallpaperbrowse.com/media/images/3848765-wallpaper-images-download.jpg" height="auto" width="auto">
<img class="mySlides fade" src="https://avante.biz/wp-content/uploads/Wallpaper-Images/Wallpaper-Images-005.jpg" height=auto width=auto>
<img class="mySlides fade" src='https://svs.gsfc.nasa.gov/vis/a010000/a012000/a012005/Swift_Tidal_Disruption_2_Still.jpg' height="auto" width="auto">
</div>
<div class='buttons'>
<a class="prev" onclick="plusDivs(-1);
clearInterval(myTimer);
myTimer = setInterval(carousel, 3500);">❮
</a>
<a class="next" onclick="plusDivs(1);
clearInterval(myTimer);
myTimer = setInterval(carousel, 3500);">❯
</a>
</div>
</div>
<script>
var myIndex = 0;
var myTimer = setInterval(carousel, 3500);
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) { myIndex = 1 }
x[myIndex - 1].style.display = "block ";
}
myTimer; //change image every 3.5 seconds
</script>
<script>
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
if (n > x.length) { slideIndex = 1 }
if (n < 1) { slideIndex = x.length }
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
x[slideIndex - 1].style.display = "block ";
}
</script>
</div>
<div class='footer'>
<img src='http://www.mastersny.org/uploaded/template/default/images/common/bottom-logo.png'>
<p>49 Clinton Avenue</p>
<p>Dobbs Ferry, NY 10522</p>
<p>(914) 479-6400</p>
</div>
</body>
感谢您的帮助!
最佳答案
在 .overlay
样式中使用 position:fixed
而不是 position:relative
。
关于html - 滑入式菜单将其他元素推开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48040758/
我复制了一个指令(并且正在工作),以便在单击时滑入滑出隐藏区域,类似于 jQuery 隐藏和显示。 然而,这只适用于元素在一起的情况,例如: Click to show.hide Stuff
我一直在研究这个菜单插件,它工作正常,但是我注意到一个问题,请看这个 JSFiddle Demo 当菜单打开时,我在菜单的右上角添加了一个关闭按钮(x),当我点击关闭时它向左滑动并隐藏但是当我再次点击
我正在尝试通过滑动或淡入淡出将我的图像加载到我的页面中。它是从数组中加载的,找不到任何相关文档。 JS: for(i =0; i 关于javascript - 从数组设置后如
我为我的网站创建了滑入/滑出侧边导航。它工作得很好,就像现在一样,但我希望让网站与侧边栏一起移动(类似于:http://demo.agnidesigns.com/fortune/demo15/)。目前
我正在开发一个 asp.net 网页,它使用 jquery slider 来滑入和滑出 div。 div 包括三个 asp 下拉列表,其值由服务器端 VB 中的页面加载例程初始化。在第一个下拉列表中,
我正在尝试更改 Ext.List 的内容。我正在尝试将内容更改为新面板,尽管我不需要更多列表元素。 这似乎替换了内容,但我如何动画更改? onItemDisclosure: function(reco
我在 UIViewController 中有一个 UIButton,我目前在应用程序打开时“淡入”以查看它。 不过,我想让 UIButton 从左向右滑入。 我不知道如何让它从左向右滑入,我的尝试都失
我目前有一个 javascript 生成多个 div(DOM 对象),如果单击第一个 div,子菜单 div 就会打开。这些子菜单使用 jQuery 幻灯片动画显示。 目前,当生成 div 时,它们会
目前我正尝试在我的应用程序中实现一些我真的不知道从哪里开始的东西。看看这张小图片: 您可以在此处的 Play 商店中找到该应用程序:https://play.google.com/store/apps
我有一个可以根据需要打开和关闭的内容 div,但我无法让内容 div 从底部滑入或滑出。我尝试使用 css 但我认为它的固定位置让我悲伤。默认情况下它应该是隐藏的,但默认情况下它会显示 $(".liv
我在谷歌上搜索了很多关于这个问题的信息。 我有一个包含 3 个 LinearLayout 的 LinearLayout。 第一个就像第二个的标题。最后一个只是一些其他内容。 我现在不想向上/向下滑动第
我正在使用 HTML 编写滑动表单。基本上我希望容器中只有两个 (f1|f2) 之一可见。但我不知道如何隐藏另一个 div,使其在页面上不可见。 https://jsfiddle.net/Lqu67y
我知道这是一些在互联网上的例子,也在 Stackoverflow 上我找到了很多例子,但不管你信不信,它们都不能满足我的需要。 Even I have asked a similar question
基本上我想要类似 this (at the 30 second mark) 的东西 我希望我的项目在 Activity 开始后按顺序滑入。 我试过谷歌搜索。我找不到任何我能理解的东西。我仍然在为 An
我正在尝试使用我创建的此类从侧面滑入 JPanel: public class AnimationClass { private int i; private int y; p
只是检查是否有人知道使用 CSS 或更有可能使用 jQuery.animate() 为 HTML 文本输入框中的文本滑出设置动画的厚颜无耻的方法。因为它们不是它们自己的元素,所以我不确定除了父输入框可
如果能提供解决此问题的帮助和见解,我将不胜感激。我正在开发一个初始可见高度为 180 像素的标题 div 的网站。标题 div 的总高度为 340px。当用户单击链接时,我需要标题 div 向下滑动以
我遇到了一个非常奇怪的问题,在这个问题上找不到任何帮助。 我的应用程序运行得很好,但有时用户界面有一个非常奇怪的行为:当我切换 View 时,下一个 View 总是从左上角滑入,这真的很难看。顺便说一
我无法让滑入/滑出和淡入/淡出工作。这就是我想要实现的目标...... 1) 对于 5K/10K 事件,当用户点击图片时使用show/hide 方法使事件列表显示和消失。 2) 对于半程马拉松比赛,当
我正在尝试创建这种效果,当点击屏幕时 AppBar 滑出,再次点击时滑入。 通过将 float 和对齐设置为 true,我能够在 SliverAppBar 中创建类似的东西。不同之处在于 appBar
我是一名优秀的程序员,十分优秀!