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 4 months 3 weeks ago #5580

  • Ron Mitchell
  • Ron Mitchell's Avatar
  • Offline
  • Administrator
  • Posts: 509
  • Thank you received: 121
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
The administrator has disabled public write access.

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

  • John Illsley
  • John Illsley's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 3
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
The administrator has disabled public write access.

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

  • Ron Mitchell
  • Ron Mitchell's Avatar
  • Offline
  • Administrator
  • Posts: 509
  • Thank you received: 121
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
The administrator has disabled public write access.

Xerte page links in Bootstrap 1 month 2 weeks ago #5682

  • Neil Pollock
  • Neil Pollock's Avatar
  • Offline
  • Senior Boarder
  • Posts: 68
  • 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.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: Julian Tenney, John Smith
Time to create page: 0.250 seconds
Powered by Kunena Forum