I have found many questions and solutions on how doing this very basic thing in jQuery to get the index number.
$(".container p").click(function() {
var index = $(this).index();
alert(index);
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
<p>One</p>
<p>Two</p>
<p>Three</p>
</div>
Ok, that's great, but obviously this is relative to .container.
How could I get the index relative to the whole page, so that if I had another .container half way up the page the index would still be counted for the next ones.
Make sense?