Scrollable blocks

Scrollable blocks

by Luis de Vasconcelos -
Number of replies: 9

I have created a quiz in Moodle 2.0.2 with the New page option under Layout set to Never, all questions on one page. When a student attempts the quiz the Quiz Navigation block is displayed in the top left corner of the window. There are 20+ questions in the quiz so the student has to scroll vertically to see all the questions. This is fine, but is there a way to make the Quiz Navigation block scroll down with the student as he scrolls down the page? This way the block will always be visible and the student can keep an eye on the countdown timer.

Average of ratings: -
In reply to Luis de Vasconcelos

Re: Scrollable blocks

by John St -

You could try playing around with the css position: fixed. You could add (to the theme css just for testing purposes, may not be cross-browser compliant)

 

.path-mod-quiz div.block {

position: fixed;

}

That block doesn't seem to have a unique id or a class other than block so it is a little harder to target.

Average of ratings: Useful (1)
In reply to John St

Re: Scrollable blocks

by Luis de Vasconcelos -

Thanks. That css does make the block scroll - but it also breaks the width of the other blocks like the Navigation and Settings blocks - those blocks now scretch across the whole screen.

When I apply your patch all the other blocks also scroll! I only want the Quiz navigation block to scroll.

Using the following css seems to prevent the blocks from stretching across the whole screen:

.path-mod-quiz div.block {
  position: fixed;
  width: 190px;
}

But I still need to find a way to prevent all the other blocks from scrolling. I only want the Quiz navigation block to scroll. Any ideas on how to achieve this?

And is it "safe" to specify a fixed width of 190px? Will it work across all screen resolutions and screen sizes?

In reply to Luis de Vasconcelos

Re: Scrollable blocks

by John St -

Like I said, that block unfortunately does not have any specific classes or ID. If we could get that added, it would make targeting it easy.

You could try just targeting that block when attempting the quiz:

#page-mod-quiz-attempt div.block {
position: fixed;
width: 190px;
}

Students only see that block during attempts (I think?) so you shouldn't need to worry about it effecting other blocks (for students at least).

Average of ratings: Useful (1)
In reply to John St

Re: Scrollable blocks

by Larry Elchuck -

Does the above  work to make the quiz block and timer float as one scrolls down the page of questions?

 

I tried it and

#page-mod-quiz-navblock div.block {
position: fixed;
width: 190px;
}

but neither worked for me when I placed either set of code in the magazine/styles/layout.css file

I did purge the cache on the server side.

In reply to Larry Elchuck

Re: Scrollable blocks

by John St -

That was for an older version of 2.0x. You could try:

.path-mod-quiz #mod_quiz_navblock {

    max-width210px;
    min-width210px;
    positionfixed;
}
 
Note that this may not be cross-browser compliant (so you may want to add browser prefix to this). I added the min and max widths to try and keep the block the right size even when it is filled up with questions. 
In reply to John St

Re: Scrollable blocks

by Larry Elchuck -

Thanks John St.

It works great in Moodle 2.2

I changed the location to the left side blocks area using:

.path-mod-quiz #mod_quiz_navblock {

    max-width: 210px;
    min-width: 210px;
    left: 80px;
    position: fixed;
}

 

Is this the best solution or should I be using a % ?

Average of ratings: Useful (1)
In reply to Larry Elchuck

Re: Scrollable blocks

by Anju Menon -

Sir,

Could you please tell me where am i supposed to put in the said code for making the quiz navigation block to float. Which file needs to be changes.

Regards,

Anju

In reply to John St

Re: Scrollable blocks

by adzlynn adzlynn -

i am new here. i have problem to do the scroll bar.can u tell me the details. example: which file i need to go and so on.