我希望能够在第一个框中隐藏/禁用上一个链接并在最后一个框中禁用下一个链接,因为此时您可以继续单击最后一个框的下一个,当您这样做时它会中断为单击上一个不再起作用。在小提琴中查看演示
<span id="wrapper">
<span id="prev"><a href="#">Go to Prev</a></span>
<span id="content">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
<div id="start" class="box">6</div>
<div class="box">7</div>
</span>
<span id="next"><a href="#">Go to Next</a></span>
var $curr = $("#start");
$curr.css("display", "inline");
$("#prev a").click(function () {
$curr = $curr.prev();
$(".box").css("display", "");
$curr.css("display", "inline");
});
$("#next a").click(function () {
$curr = $curr.next();
$(".box").css("display", "");
$curr.css("display", "inline");
});