Moodle 2 - show Menu Links as PopUps or resized

Moodle 2 - show Menu Links as PopUps or resized

by Mark Woods -
Number of replies: 1
We're using the menu settings in Moodle 2 - AfterBurner theme: ► Site administration ► Appearance ► Themes ► Theme settings We've managed to get menus to display links as new windows but we're struggling to get them to open up as pop-ups or just re-sized windows on top of content. For example ... the settings below show the menu item REGISTER and when selected shows it as a full new window - however, the form just needs a window 300 width x 400 height ... anyone any idea how we can do this ? The full screen is ugly and a re-sized window will look much better. Register|http://www.xxxxx.org/theme/afterburner/register.html" target="new" We've tried just about everything we can think of including width=300 etc but these have no effect .... Thanks in advance Mark
Average of ratings: -
In reply to Mark Woods

Re: Moodle 2 - show Menu Links as PopUps or resized

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Mark, I have found a way to do this but I have only tested this in Moodle 2.1.5 as I am not sure which version of Moodle you have. Here is the fix:
  • Create a new directory in your current theme folder and call it javascript
  • Copy the following into Notepad and save it as urlpopup.js and add it to the javascript folder you just created
    function urlpopup(url) {
        newwindow=window.open(url,'name','height=300,width=300');
        if (window.focus) {newwindow.focus()}
        return false;
    }
    
  • When creating the LINK you add it in the following way...
    Moodle community|"http://moodle.org onclick="return urlpopup('http://moodle.org')
  • Next OPEN your theme's config.php and add the following line to the end of that file...
    $THEME->javascripts_footer = array('urlpopup');
With luck this should work. PS: I got the idea from www.quirksmode.org Cheers Mary