[SOLVED][Drupal Colorbox][Drupal 7] How to change the position of the Colorbox overlay?

| | 1 min read

Many Drupal users wanted to know how to change the position of the Colorbox overlay?. If you are faced with the same question in Colorbox in your Drupal site and wish to know the solution to adjust the position of Colorbox then read on to find out more.

Here is the solution.

  • Colorbox accepts postions settings for top, right, bottom and left. However the Drupal Colorbox module does not provide options for you to change. Instead you need to write some custom Javascript code to pass the required values to Colorbox.
  • You can reposition Colorbox using the jQuery code as shown below in your own module.
    $('a#your-id').colorbox({top:50, left:50});
  • Remember to change the id to your own link ID and set the parameters to the ones your desire. The bottom and right properties are also available to the function.
  • You can also pass the position parameters directly in the URL as shown below.
    <a class="colorbox-load" href="http://yourdomain.com/video/9Ljik6adl?width=300&height=150&top=40&right=20&iframe=true">link</a>

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.