【发布时间】:2015-05-12 11:11:40
【问题描述】:
我只是想知道当我单击网站右侧的按钮时如何制作动画以滑到另一个页面。我希望黑色的页眉和页脚保持完整,但是当单击按钮时在右侧,我希望空白区域滑动到下一页。
另外,当我将鼠标悬停在按钮上时,如何让文本出现,我似乎无法实现?
这是我的代码,供任何希望提供帮助的人使用
CSS:
html {
height: 100%;
font-family: volkorn;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
margin-bottom: 50px;
}
/* Top Black Section */
.top-bar {
position: fixed;
width: 100%;
height: 50px;
background-color: black;
top: 0px;
left: 0px;
}
/* Top Black Section */
/* White Area */
.white-content {
margin-top: 50px;
}
/* White Area */
/* Bottom Black Section */
.bottom-bar {
position: fixed;
width: 100%;
height: 50px;
background-color: black;
bottom: 0px;
left: 0px;
}
/* Bottom Black Section */
.ulogo {
position: fixed;
height: 40%;
background-color: transparent;
top: 250px;
text-align: center;
}
/* Bottom Black Section */
/* Right Navigation */
.right-nav {
position: fixed;
right: 0px;
top: calc(50% - 120px);
}
.right-nav div {
font-size: 3em;
color: #C0C0C0 ;
transition: color .3s;
cursor: pointer;
}
.right-nav div:hover {
color: #404040;
}
/* Right Navigation */
HTML:
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<title>Upload Festival</title>
<head>
<!-- CSS -->
<link href="css/customization.css" rel="stylesheet" style="text/css">
<!-- CSS -->
<!-- jQuery&WebFont -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js"></script>
<!-- jQuery&WebFont -->
</head>
<body class="index">
<!-- Top Border -->
<div class="top-bar"></div>
<!-- Top Border -->
<!-- White Content -->
<div class="white-content"></div>
<!-- White Content -->
<!-- Bottom Bar -->
<div class="bottom-bar"></div>
<!-- Bottom Bar -->
<!--Buttons-->
<div class="right-nav">
<div id="b1">•</div>
<div id="b2">•</div>
<div id="b3">•</div>
<div id="b4">•</div>
</div>
<!--Buttons-->
<!--Logo div-->
<div class="logo"></div>
<!--Logo div-->
<!--Transition Section-->
<div class="slider"></div>
<!--Transition Section-->
<!-- Logo - Left -->
<img class ="ulogo" src="images/upload-logo.png">
<!-- Logo - Left -->
</body>
</html>
【问题讨论】:
-
你能把这些都放在js fiddle里吗?这可以通过锚链接触发器来完成。我可以告诉你如果你可以把代码放在小提琴上
-
没问题 - jsfiddle.net/kLunbwqo
-
感谢您的帮助@nolawipetros
-
请把相关代码放在fiddle中。你的导航部分在哪里?你的目标是什么?它是另一个 html DOM 元素还是完全不同的页面?我看到你已经在“div”中放置了一个悬停伪类,但是然后呢?简而言之,您到底尝试了什么?
-
jsfiddle.net/kLunbwqo/1 - 我的目标是保持相同的页面,我不想要一个完全不同的页面,我只希望白色部分的内容,如文本、图像等过渡到另一个部分,当我单击一个按钮时,它上面有内容,但只是让它在空白处改变,没有其他地方。
标签: html css transition slide