滑动关闭的div使用jQuery +添加导航箭头屏 [英] Slide divs off screen using jQuery + added navigation arrows
问题描述
任何人都可以与添加导航箭头在这里找到了code片断帮助
Can anyone help with adding navigation arrows to the code snippet found here
滑动的div屏幕外使用jQuery
和第一次的答案给出.... http://jsfiddle.net/jtbowden/ykbgT/2/
我希望能够增加方向箭头或preV /下一个链接
I want to be able to add direction arrows or prev/next links
code以下
HTML
<div id="container">
<div id="box1" class="box">Div #1</div>
<div id="box2" class="box">Div #2</div>
<div id="box3" class="box">Div #3</div>
<div id="box4" class="box">Div #4</div>
<div id="box5" class="box">Div #5</div>
</div>
CSS:
body {
padding: 0px;
}
#container {
position: absolute;
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
overflow: hidden;
}
.box {
position: absolute;
width: 50%;
height: 300px;
line-height: 300px;
font-size: 50px;
text-align: center;
border: 2px solid black;
left: 150%;
top: 100px;
margin-left: -25%;
}
#box1 {
background-color: green;
left: 50%;
}
#box2 {
background-color: yellow;
}
#box3 {
background-color: red;
}
#box4 {
background-color: orange;
}
#box5 {
background-color: blue;
}
JavaScript的:
javascript:
$('.box').click(function() {
$(this).animate({
left: '-50%'
}, 500, function() {
$(this).css('left', '150%');
$(this).appendTo('#container');
});
$(this).next().animate({
left: '50%'
}, 500);
});
它的工作原理,但出色的导航是一个方向,并通过单击框激活
It works brilliantly but navigation is one direction and activated by clicking the boxes
在此先感谢
AOR
推荐答案
应该很容易做到:)
做一个导航控制包装元素:
make a "navigation control" wrapper element:
var $controller = $('<div class="control-wrapper" />);
加2主要内容,作为左,右移动按钮:
add 2 main elements to act as left and right movement buttons:
var $left = $('<span class="move left" />').appendTo($controller),
$right = = $('<span class="move right"/>').appendTo($controller);
添加事件处理程序,以每个动作元素的每个动画:
add an event handler to each movement element for each animation:
$left.click(function(event) {
////MOVE THE NAV LEFT
};
$right.click(function(event) {
////MOVE THE NAV RIGHT
};
替换意见与函数调用移动导航(你已经将它移到左逻辑;))
replace the comments with function calls to move the nav (you already have the logic to move it left ;) )
请注意:请确保您添加光标:指针的按钮元素的CSS类,以便他们似乎可以点击用户
NOTE: Make sure you add "cursor: pointer" to the button element CSS classes so that they appear to be clickable to the user.
这篇关于滑动关闭的div使用jQuery +添加导航箭头屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!