Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
Hi I was wondering if it's possible to remove this menu on the right-hand side of course home pages (see image attached). We don't need it as we're not using this as an actual course, but rather as a 'community' of modules that students can dip in and out of. Apart from it not being necessary,it also squishes up the home page and the banner at the top making things look a bit weird - so we'd rather that menu weren't there. Does anyone know of a way to remove it?
Thank you,
Maria
Hi @MMatheas,
You just want to remove that menu for a single course, and only for students, correct? You'll definitely need to use javascript in an account/subaccount theme to accomplish that selectively.
The following javascript should hide the right column:
document.getElementById('right-side-wrapper').style.display='none'
You can put that statement under an if condition for the specific course like:
if (window.location.href.indexOf("/courses/92995") > -1)
But doing it for just students can become more complicated... Without getting into more scripting and API calls, about the best you can do (as far as I know) is to check if the user is a stduent in *any* course in your instance. You do this like the following:
if (ENV.current_user_roles.indexOf('student') > 0)
You'll also want to call this script only after the document is ready... All together, this would make the script:
var do_global_customizations = function(){
if ((window.location.href.indexOf("/courses/92995") > -1) && (ENV.current_user_roles.indexOf('student') > 0)){
document.getElementById('right-side-wrapper').style.display='none'
}
}
if (document.readyState === "complete" || (document.readyState !== "loading" && !document.documentElement.doScroll)) {
do_global_customizations();
} else {
document.addEventListener("DOMContentLoaded", do_global_customizations);
}
Since this does happen with theme javascript, a Canvas admin would have to agree to his method and insert the code into the theme. There is also a caveat that Instructure could make changes to their code at any time that may require modifications to custom javascript like this, so it's always a bit risky to go this route. Personally, I'd probably just leave the menu there.
Hi @chriscas ,
Thanks for providing this js.
I do not entirely want to remove the left sidebar but want it closed for my students upon Ioading of the page. Will this work too?
document.getElementById('right-side-wrapper').style.display='close'
or
document.getElementById('right-side-wrapper').style.display='hide'
Use this code in HTML-mode in your frontpage.
<style>
.with-right-side #right-side-wrapper {
display: none;
}
</style>
This will remove the right side menu's.
Make sure you do this when you have your page ready...as a final step. Because when saving the page.. Canvas sanitizes the HTML and will remove the style tags completely. However doing this will override Instructure Canvas main CSS in which this rule is set, and it will work...untill you edit and save the page...Then its gone.
does this still work as of now? they seem to have patched it. extremely annoyed that I can't use styling tags to make posts anymore.
Still works on our Canvas...
To participate in the Instructure Community, you need to sign up or log in:
Sign In