简单的Jquery滑块,不想使用插件
我有以下代码,到目前为止我已经实现了类似的东西,但我想为此添加“NEXT”“PREV”功能,为此我需要建议。
<div id="slider">
<div class="wrap">
<div class="panel">Panel1</div>
<div class="panel">Panel2</div>
<div class="panel">Panel3</div>
</div>
<div class="previous">This need Implementation</div>
<div class="next">This need Implementation</div>
</div>
<div class="nav">
<ul>
<li> panel1</li>
<li> panel2</li>
<li> panel3</li>
<ul>
</div>
$(document).ready(function () {
$(".wrap .panel:not(.active)").fadeOut();
$(".wrap .panel:first(.active)").fadeIn();
$(".nav ul li").click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$(".wrap .panel").stop(true, true).fadeOut().eq($(this).index()).fadeIn();
});
});
I have the following code, I have implemented something like this so far, but I want to add "NEXT" "PREV" functionality to this, for which I need suggesstion.
<div id="slider">
<div class="wrap">
<div class="panel">Panel1</div>
<div class="panel">Panel2</div>
<div class="panel">Panel3</div>
</div>
<div class="previous">This need Implementation</div>
<div class="next">This need Implementation</div>
</div>
<div class="nav">
<ul>
<li> panel1</li>
<li> panel2</li>
<li> panel3</li>
<ul>
</div>
$(document).ready(function () {
$(".wrap .panel:not(.active)").fadeOut();
$(".wrap .panel:first(.active)").fadeIn();
$(".nav ul li").click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$(".wrap .panel").stop(true, true).fadeOut().eq($(this).index()).fadeIn();
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要存储当前显示的窗格的索引
you need to store the index of the current pane displayed