AnsweredAssumed Answered

Preventing previous/next jumps between modules

Question asked by Michael Marboe on Jul 27, 2017
Latest reply on Feb 9, 2020 by STEVEN CATANIA

Hello Canvas community,


This is a very circumstantial issue that I've been unable to solve. We're designing navigation in certain courses to work in a slightly different way than usual. 


I won't bore you with the lengthy details, but we need to prevent students from being able to jump between different modules using the Next/Previous buttons. It's fine that they jump between pages/assignments/quizzes within the same module. 


Is there any way to accomplish this? For now, the only solution I can see is to control access to modules by publishing/unpublishing but this is only a backup-plan for now.


Scripts, work-arounds or other clever solutions - anything goes.


Thanks in advance. :-) 




EDIT - problem has been solved, see Christopher Esbrandt's solution for a functional script.

I was working on a lighter script - it is not fully functional yet, but if anyone wants to complete it, here it is. It works by scanning the content div for the tooltip "Næste modul" ("Next module") and then setting the display property of the next button to none. The setTimeout function was implemented because of the order of the content generation, ensuring that the next button is removed after it has been loaded (and not before, which would accomplish nothing). If the tooltip text "Næste modul" cannot be found, the script simply returns an error message.



function removeNext() {
   var markup = document.getElementById("content").outerHTML;
   n = markup.includes("Næste modul:");
   if (n==true){ 
   $(".module-sequence-footer-button--next").css("display", "none"); 
   }, 1000);