[SOLVED][Drupal Colorbox] How to add a custom Colorbox style to your theme?

| | 1 min read

Many Drupal users wanted to know add a custom Colorbox style to your theme so that they can apply their custom styles to the Colorbox popup. If you are looking for way to add a custom Colorbox style to your theme in your Drupal website then continue reading.

Follow the steps below to add a custom Colorbox style to your theme:

  • You can start with either the default style or one of the example styles included in the Colorbox JS library.
  • Simply copy the entire style folder of Colorbox to your theme's folder & rename it to something logical like "mycolorbox".
  • The folder contains a .css and .js file.
  • You must proceed to rename both the files to match your folder name.
  • In the next step you have to add entries in your theme's .info file for the said files as follows
    stylesheets[all][] = mycolorbox/colorbox_mycolorbox.css
    scripts[] = mycolorbox/colorbox_mycolorbox.js
  • Next go to Admin>Configuration>Colorbox settings & select "None" under "Styles and Options".
  • This will leave the styling of Colorbox up to your theme.
  • Finally make any necessary CSS adjustments to your "colorbox_mycolorbox.css" file.
  • Clear all the caches in your Drupal site.

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.