Report any technical problems you discover and discuss solutions.

Xerte page links in Bootstrap

More
7 years 7 months ago #5580 by ronm
Replied by ronm on topic Xerte page links in Bootstrap
Ok for the moment please try the following:

1. Select the first icon in your bootstrap project and add an optional script property
2. Add the following code to that script box either below or replacing the default //javaScript / jQuery
Code:
function x_navigateToPage(force, pageInfo) { // pageInfo = {type, ID} var pages = $(data).find('page'); var links = ['[first]', '[last]', '[previous]', '[next]']; var linkLocations = [0, pages.length-1, Math.max(0,currentPage-1), Math.min(currentPage+1,pages.length-1)]; // First look for the fixed links if ($.inArray(pageInfo.ID, links) > -1) { parseContent(linkLocations[$.inArray(pageInfo.ID, links)]); goToSection('topnav'); $('html, body').animate({ scrollTop: 0 }, 'fast'); } else { // Then look them up by ID for (var i=0; i<pages.length; i++) { if (pages[i].getAttribute("linkID") == pageInfo.ID) { parseContent(i); goToSection('topnav'); $('html, body').animate({ scrollTop: 0 }, 'fast'); break; } if (pages[i].childNodes.length > 0) { for (var j=0; j<pages[i].childNodes.length; j++) { if (pages[i].childNodes[j].getAttribute && pages[i].childNodes[j].getAttribute("linkID") == pageInfo.ID) { parseContent(i); goToSection('page' + (i+1) + 'section' + (j+1)); break; } } } } } }

You can see this working via xot.xerte.org.uk/play.php?template_id=138
Please report back whether this does what you want?
This should work as a temporary solution for you for now but I don't want to commit this as a change to core Xerte code yet because longer term we need to add a choice so that if someone want to add a page link to a specific page but also a specific section or tab in a page that they can choose to do so e.g. it might not always be the case that you want to jump to the top of the destination page.

HTH
Ron

Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago #5581 by jsi22
Replied by jsi22 on topic Xerte page links in Bootstrap
Thanks Ron, this works for us. It will be good if this can be integrated into a future version of Xerte so we don't have to add it to each bootstrap project.

Regards,
John

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago #5582 by ronm
Replied by ronm on topic Xerte page links in Bootstrap
Thanks for confirming it works for you John.
Yes we'll add this or something similar sooner rather than later and then (once your install is upgraded) you will be able to remove the custom script from any projects to which you have added it. But also we have many more enhancements and additions planned and will be working on some of those next week where some of us will be working together following the Future Teacher Conference and there may well be a new release by the end of January.

HTH
Ron

Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/

Please Log in or Create an account to join the conversation.

  • Neil Pollock
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
7 years 4 months ago #5682 by Neil Pollock
Replied by Neil Pollock on topic Xerte page links in Bootstrap
Just to say, this doesn't work if you have a fixed top nav bar and click the page links from there.

Please Log in or Create an account to join the conversation.

Moderators: ronmjultenJohnSmith
Time to create page: 0.534 seconds
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo