Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
Report any technical problems you discover and discuss solutions.
  • Page:
  • 1
  • 2

TOPIC: Xerte page links in Bootstrap

Xerte page links in Bootstrap 9 months 2 weeks ago #5580

  • ronm
  • ronm's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 532
  • Thank you received: 129
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
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
Need direct commercial support? mitchellmedia.co.uk/contact/

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

Xerte page links in Bootstrap 9 months 2 weeks ago #5581

  • jsi22
  • jsi22's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
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.

Xerte page links in Bootstrap 9 months 2 weeks ago #5582

  • ronm
  • ronm's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 532
  • Thank you received: 129
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
Need direct commercial support? mitchellmedia.co.uk/contact/

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

Xerte page links in Bootstrap 6 months 1 week ago #5682

  • Neil Pollock
  • Neil Pollock's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 73
  • Thank you received: 3
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.

  • Page:
  • 1
  • 2
Moderators: jultenjjs
Time to create page: 0.077 seconds
Copyright © 2019 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search