Сообщение от Aruta
|
Нельзя по индексу
|
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.inner-2-1-1 {
display: none;
}
.inner-2-1-1.act {
display: block;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
$(document).on('click','.next',function(e){
var index = $('.next').index(this);
$('.wrapper-1').show();
$('.inner-top-1-1').hide().eq(index++).show()
$('.inner-2-1-1').hide().eq(index).show()
})
$(document).on('click','.back',function(e){
var index = $('.back').index(this) ;
$('.wrapper-1').toggle(index > 0);
$('.inner-2-1-1').hide().eq(index--).show();
$('.inner-top-1-1').hide().eq(index).show();
})
});
</script>
</head>
<body>
<div class="wrapper-1" style="display:none"> wrapper-1
<div class="inner-top-1-1" style="display:none">1</div>
<div class="inner-top-1-1" style="display:none">2</div>
<div class="inner-top-1-1" style="display:none">3</div>
<div class="inner-top-1-1" style="dispaly:none">4</div>
</div>
<div class="inner-2-1-1 act">
<div>
<div class="next">next 1</div>
</div>
</div>
<div class="inner-2-1-1">
<div>
<div class="back">back 0</div>
<div class="next">next 2</div>
</div>
</div>
<div class="inner-2-1-1">
<div>
<div class="back">back 1</div>
<div class="next">next 3</div>
</div>
</div>
<div class="inner-2-1-1">
<div>
<div class="back">back 2</div>
<div class="next">next 4</div>
</div>
</div>
<div class="inner-2-1-1">
<div>
<div class="back">back 3</div>
</div>
</div>
</body>
</html>