|
|
Line 51: |
Line 51: |
| } | | } |
| return res + "</span>".repeat(spans); | | return res + "</span>".repeat(spans); |
| }
| |
|
| |
|
| |
| $(function() {
| |
| $(document).ready(function() {
| |
| let active = $('.pageactive');
| |
| active.each((_, page) => {
| |
| setupPage($(page))
| |
| });
| |
| });
| |
| $('.book_leftarrow').click(function() {
| |
| let active = $(this).siblings('.pageactive');
| |
| active.removeClass('pageactive');
| |
| active = active.prev()
| |
| setupPage(active);
| |
| });
| |
| $('.book_rightarrow').click(function() {
| |
| let active = $(this).siblings('.pageactive');
| |
| active.removeClass('pageactive');
| |
| active = active.next()
| |
| setupPage(active);
| |
| });
| |
| });
| |
|
| |
| function setupPage(active) {
| |
| active.addClass('pageactive');
| |
| let index = active.index();
| |
| let length = (active.siblings().length - 2);
| |
| active.siblings('.book_pagenum').text('Page ' + index + ' of ' + length);
| |
| active.siblings('.book_leftarrow, .book_rightarrow').show()
| |
| if (index == 1) {
| |
| active.siblings('.book_leftarrow').hide()
| |
| }
| |
| if (index == length) {
| |
| active.siblings('.book_rightarrow').hide()
| |
| }
| |
| } | | } |