Skip to content

Commit 469bb03

Browse files
author
bcgwebdesign
committed
working prev next nav
1 parent b958105 commit 469bb03

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

themes/doi-theme/assets/sass/partials/_handbook.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@
6262
.prev,.next {
6363
border:1px solid lightgrey;
6464
flex-basis:50%;
65-
border-radius:10px;
66-
padding:10px;
65+
padding:10px 20px;
66+
&:hover {
67+
cursor:pointer;
68+
background-color:#5c7292;
69+
color:#fff;
70+
}
6771
}
6872
.prev {
6973

themes/doi-theme/static/data/handbook-html.xslt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
</xsl:choose>
156156
<div class='prevnextnav'>
157157
<div class='prev'>
158-
Prev
158+
Previous
159159
<div class='prevtext'>ppp</div>
160160
</div>
161161
<div class='next'>

themes/doi-theme/static/js/script.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ $(function() {
113113

114114

115115
// separated out the clicks - this one for the left top level nav
116-
$('#handbook-holder').on('click', '.tabs-nav nav.top-nav > a',function(e) {
116+
$('#handbook-holder').on('click', '.tabs-nav nav.top-nav > a, .prevnextnav .prev, .prevnextnav .next',function(e) {
117117
const nav_elements = $('.tabs-nav nav.top-nav > a');
118118
var id=$(this).closest('nav').attr('internal-destination');
119+
if (!id) {
120+
id = $(this).attr('internal-destination');
121+
}
119122
console.log("ID = " + id);
120123

121124
$('.tabs-content .content.visible div.section-main > *:not(.chapters)').show();
@@ -222,6 +225,7 @@ $(function() {
222225
$('html body').scrollTop($('.footnote#' + $(this).attr('rid')).offset().top);
223226
});
224227

228+
//--------------------------------------------------------------------------------------------------------
225229
function fixFootnotes() {
226230
$('.footnote sup').remove();
227231
$('.footnote-link').each(function(index) {
@@ -230,27 +234,35 @@ $(function() {
230234
}
231235

232236

237+
//--------------------------------------------------------------------------------------------------------
233238
function genPrevNextLevelN() {
234239
console.log('genprevnext level 1');
235240
var nextsection=$('.content.visible').next()
236241
var nextsectionid=nextsection.attr('internal-destination');
237242
var nextsectiontitle=nextsection.find('.section-title').text();
238243
if (!nextsectionid) {
239244
$('.content.visible .prevnextnav .next .nexttext').text('');
245+
$('.content.visible .prevnextnav .next').css('visibility','hidden');
240246
} else {
241247
$('.content.visible .prevnextnav .next .nexttext').text(nextsectiontitle);
248+
$('.content.visible .prevnextnav .next').attr('internal-destination',nextsectionid);
249+
$('.content.visible .prevnextnav .next').css('visibility','visible');
242250
}
243251

244252
var prevsection=$('.content.visible').prev()
245253
var prevsectionid=prevsection.attr('internal-destination');
246254
var prevsectiontitle=prevsection.find('.section-title').text();
247255
if (!prevsectionid) {
248256
$('.content.visible .prevnextnav .prev .prevtext').text('');
257+
$('.content.visible .prevnextnav .prev').css('visibility','hidden');
249258
} else {
250259
$('.content.visible .prevnextnav .prev .prevtext').text(prevsectiontitle);
260+
$('.content.visible .prevnextnav .prev').attr('internal-destination',prevsectionid);
261+
$('.content.visible .prevnextnav .prev').css('visibility','visible');
251262
}
252263
}
253264

265+
//--------------------------------------------------------------------------------------------------------
254266
function genPrevNextLevelNN() {
255267
console.log('genprevnext level 2');
256268
var nextchapter=$('.chapters.visible').next()
@@ -265,7 +277,7 @@ $(function() {
265277
} else {
266278
$('.content.visible .prevnextnav .next .nexttext').text(nextchaptertitle);
267279
}
268-
280+
269281
var prevchapter=$('.chapters.visible').prev()
270282
var prevchapterid=prevchapter.attr('internal-destination');
271283
var prevchaptertitle=prevchapter.find('h3:first').text();
@@ -279,8 +291,7 @@ $(function() {
279291
}
280292
}
281293

282-
283-
294+
//--------------------------------------------------------------------------------------------------------
284295
function donav() {
285296
// search querystring for error param value
286297
var matches = window.location.search.match(/xref=([\w.]+)/);

0 commit comments

Comments
 (0)