Advertising sustains the DA. Ads are hidden for members. Join today

Basic usage

Last updated on
11 April 2023

There're two ways to use the lightgallery, using a view style and a field formatter.

Using the view style

After installing the module, you can check the admin/structure/views page, you'll see a new view called lightgallery. This view is installed along with the module.

Lightgallery view

Let's click on Edit button to see more details.

view details

As you can see the view is a page, you can create a block view of course, this is just an example, the important part is the FORMAT, it's a Lightgallery format, if you click on the Settings link, you'll see all the lightgallery options.

All the lightgallery behavior can be customized here, on the style options, here are some of the functionalities:

  • Change the animation transition. Lightgallery core settings > Transition
  • Disable download button. Lightgallery core settings > Download
  • Disable loop. Lightgallery core settings > Loop
  • Change thumbnails dimensions. Lightgallery Thumbnail settings > Width or Lightgallery Thumbnail settings > Height
  • Disable autoplay. Lightgallery Autoplay settings > Autoplay
  • Enable the image zoom. Lightgallery Zoom settings > Zoom

IMPORTANT: To be able to properly use Lightgallery, you'll need to configure an image field. The view provided by the module after installing, already has an image field on the FIELDS section.

To configure the image field and thumbnail, open up the Lightgallery options settings and mark the image field:

After all the view is configured, you can see the results (the default view is looking at any kind of content published with images), open up the /lightgallery path and click on an image to see lightgallery working.

Using lightgallery field formatter

The module provides a way to set lightgallery into any image field using a field formatter.

After you install a new drupal instance, you'll have two content types, Article and Basic page, the Article content type already has an image field, so let's use it to test.

Once you open up the Article manage display (admin/structure/types/manage/article/display), you can change the format for the image field to be Lightgallery.

Once you choose Lightgallery  as the field formatter, you click at the gear on the right side of the table to see all the options for lightgallery.

Both view style and field formatter have the same options, so here you'll see options like the ones bellow:

  • Change the animation transition. Lightgallery core settings > Transition
  • Disable download button. Lightgallery core settings > Download
  • Disable loop. Lightgallery core settings > Loop
  • Change thumbnails dimensions. Lightgallery Thumbnail settings > Width or Lightgallery Thumbnail settings > Height
  • Disable autoplay. Lightgallery Autoplay settings > Autoplay
  • Enable the image zoom. Lightgallery Zoom settings > Zoom

You're free to customize all the options.

Now when you create a new Article node with an image, you'll be able to click on the image and the lightgallery will open.

Help improve this page

Page status: No known problems

You can: