add options to the lightbox2 while using WordPress without plugin

446 views Asked by At

I included Lightbox into my self made WordPress-Theme - but without using a plugin. I used this script:

<script>
    jQuery(function($) {
       jQuery('a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"]').attr('data-lightbox', 'gallery'); 
    });
</script>

now I want to add the Lightbox2-Options with the following script:

<script>
    lightbox.option({
      'resizeDuration': 200,
      'wrapAround': true
    })
</script>

but it doesn't work and the console turns back

Uncaught ReferenceError: lightbox is not defined
at (index):265

How can I include the options? Thank you for your help!

1

There are 1 answers

0
Nils Manuel Mora On

Found the answer myself:

<script>
  jQuery(function() {
    lightbox.option ({
      albumLabel: '<?php _e('Bild %1 von %2', 'yourtext'); ?>',
      alwaysShowNavOnTouchDevices: true,
      disableScrolling: true,
    });
  });
</script>