嘿所有,另一个有趣的一个,jQuery的动画水平滑过
我建设,将整个页面的整个宽度滑动菜单(宽度:100%;),需要一些帮助。我有一个箭头按钮浮动在页面的右侧,将触发菜单栏点击时滑出。我希望箭头按钮在其前面滑出,并一次性将箭头图像更改为相反的文件。
最大的问题是它们的宽度和高度需要灵活以适应不同的内容。我做了一个微弱的尝试,但我知道我在这里错过了很多因素。我的代码甚至没有触及移动箭头按钮以及其余部分..这不是没有努力!
任何帮助?谢谢!
HTML:
<div id="main">
<div class="trans" id="trigger">
<img class="arrow_small" src="images/left_small.png" alt="slide out menu" />
</div>
<div id="slider">
<div class="trans" id="overlay"></div>
<div id="content">
<p>this is the content</p>
</div>
</div>
</div>
CSS:
#main {
width:100%;
height:306px;
top:50%;
margin-top:-153px;
position:absolute;
}
#trigger {
width:30px;
height:100%;
float:right;
background-color:#000;
position:relative;
z-index:3;
}
.arrow_small {
position:absolute;
left:50%;
top:50%;
margin-left:-6px;
margin-top:-12px;
}
#overlay {
width:100%;
height:100%;
position:absolute;
}
#content {
width:100%;
height:100%;
position:absolute;
z-index:2;
的Javascript:
$(document).ready(function(){
//hide functions
$('#slider').css('display', 'none');
//menu slide out
$('#trigger').click(function(){
var bar = $('#slider');
bar.show(function(){
this.animate({'marginRight':'100%'},1000);
});
});
});
下面是另一种[横向页面滑动]的方法(http://stackoverflow.com/questions/24414642/responsive-horizontal-page-sliding-navigation/24465646#24465646) – 2014-07-08 13:28:30