Modal window (lightbox)
A modal window, or lightbox, is a container that displays additional content over the top of a page.
On UQ Standard, a lightbox expands as a central overlay that dims the parent page behind it.
Users can then view content such as videos or images in the centre of the overlay without having to leave the page.
Use a lightbox when you want to:
- display content without crowding a page
- keep a user on a particular page.
Don't use a lightbox to display:
- forms
- large amounts of content
- content that may expand again when a user interacts with it.
How to create a lightbox
Submit an IT request to have lightboxes enabled on your site.
Once enabled, lightboxes can be created and edited by:
- editors
- site coordinators.
Using a lightbox for images
To add a lightbox to an image on your page, go to your WYSIWYG editor and:
- Select the content (text or image) that will expand as a lightbox.
- Click the link icon.
- From the window, select 'URL' from the 'Link type' drop-down menu.
- Click the 'Browse server' button, then double click the full-size image you want to link to.
- Go to the 'Advanced' tab and type colorbox into the 'Stylesheet Classes' box.
- Select 'OK' and then 'Save' to publish the page.
Using a lightbox for videos
To add a lightbox to a video on your page, go to your WYSIWYG editor and:
- Select the content (text or image) that will expand as a lightbox.
- Click the link icon.
- From the window, select 'URL' from the 'Link type' drop-down menu.
- In the 'URL' field, enter the video's embed URL (this is under 'Share' on YouTube or Vimeo).
- Add ?width=960&height=540&iframe=true to the end of the URL. You can change the width and height values.
- Go to the 'Advanced' tab and type colorbox-load into the 'Stylesheet Classes' box.
- Select 'OK' and then 'Save' to publish the page.
Best practice
- Use lightboxes when you need to keep a user on the parent page.
- Test your lightbox on different screen sizes to make sure the content displays as expected on mobile.
- Only use a modal if the content can't be included on the page itself.