Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<div id="imgNext">Next</div>
<div id="imgPrev">Previous</div>
<div id="GeneralSection">Section 1</div>
<div id="GeneralSection">Section 2</div>
<div id="GeneralSection">Section 3</div>
<div id="GeneralSection">Section 4</div>
<div id="GeneralSection">Section 5</div>
<div id="GeneralSection">Section 6</div>
<div id="GeneralSection">Section 7</div>
</body>
</html>
 
$(function() {
  $('div#GeneralSection').slice(1).hide(); // hide all section, except for first one
  $('#imgNext').on('click', function() {
    var section = $('div#GeneralSection').filter(':visible');
    if ($(section[0].nextElementSibling).attr('id') != "GeneralSection")
      return;
    section.hide();
    $(section[0].nextElementSibling).show();
  });
  
  $('#imgPrev').on('click', function() {
    var section = $('div#GeneralSection').filter(':visible');
    if ($(section[0].previousElementSibling).attr('id') != "GeneralSection")
      return;
    section.hide();
    $(section[0].previousElementSibling).show();
  });
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers