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 5 years 10 months ago #5580

  • ronm
  • ronm's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 852
  • Thank you received: 261
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
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.

Xerte page links in Bootstrap 5 years 10 months ago #5581

  • jsi22
  • jsi22's Avatar
  • Offline
  • New Member
  • New Member
  • 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 5 years 10 months ago #5582

  • ronm
  • ronm's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 852
  • Thank you received: 261
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.

Xerte page links in Bootstrap 5 years 7 months ago #5682

  • Neil Pollock
  • Neil Pollock's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 92
  • Thank you received: 4
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: ronmjultenJohnSmith
Time to create page: 0.048 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search