I'm using Lightbox2 for an image gallery on a Drupal 6 site that's in development. For the most part, it's been working perfectly.

However, I find the resizing transition animation between images in Lightbox to be a bit distracting for the images that I'm displaying (especially considering that a lot of my images vary widely in size, so the animation is even more pronounced). When I tried to turn off the animation in admin/settings/lightbox2 (under Advanced Settings > Animation Settings) by setting the values to 0, I get the following error message from Drupal:

"You must enter a duration between 0 and 10 seconds."

I can disable the animation by modifying the below line in lightbox2.module, but I want to avoid messing with the code itself (modifications lost in updates, not database-driven, etc), so I'd like to be able to set it in the Lightbox2 settings in Drupal.

    'resize_speed' => 1000 * variable_get('lightbox2_resize_speed', 0.4),
    'fade_in_speed' => 1000 * variable_get('lightbox2_fadein_speed', 0.4),
    'slide_down_speed' => 1000 * variable_get('lightbox2_slidedown_speed', 0.6),

Any ideas? Is this a bug, or intended behavior (since 0 is technically not between 0 and 10 seconds, exclusive)?

Comments

peterjmag’s picture

So I modified the form validation code in my lightbox2.admin.inc to change from "between 0 and 10 exclusive" to "between 0 and 10 inclusive" by removing the equals sign from the appropriate operators. However, when I do that and change the Lightbox animation values to 0 (which the module now allows me to set without any errors), the animation still occurs with the default settings (resize_speed and fadein_speed at 0.4, and slide_down_speed at 0.6). Another thing possibly worth noting is that if I set those values to 0 in the configuration, the "Resize sequence" seems to change, even though I haven't changed it in the settings. If it was simultaneous before, it now changes to "width then height," even though this change isn't reflected in the Lightbox2 settings.

Below is the modification I made in lightbox2.admin.inc, under the lightbox2_general_settings_form_validate function.

From this:

      if (!is_numeric($resize_speed) || $resize_speed <= 0 || $resize_speed >= 10) {
        form_set_error('lightbox2_resize_speed', t('You must enter a duration between 0 and 10 seconds.'));
      }

      if (!is_numeric($fadein_speed) || $fadein_speed <= 0 || $fadein_speed >= 10) {
        form_set_error('lightbox2_fadein_speed', t('You must enter a duration between 0 and 10 seconds.'));
      }

      if (!is_numeric($slide_down_speed) || $slide_down_speed <= 0 || $slide_down_speed >= 10) {
        form_set_error('lightbox2_slidedown_speed', t('You must enter a duration between 0 and 10 seconds.'));
      }

To this:

      if (!is_numeric($resize_speed) || $resize_speed < 0 || $resize_speed > 10) {
        form_set_error('lightbox2_resize_speed', t('You must enter a duration between 0 and 10 seconds.'));
      }

      if (!is_numeric($fadein_speed) || $fadein_speed < 0 || $fadein_speed > 10) {
        form_set_error('lightbox2_fadein_speed', t('You must enter a duration between 0 and 10 seconds.'));
      }

      if (!is_numeric($slide_down_speed) || $slide_down_speed < 0 || $slide_down_speed > 10) {
        form_set_error('lightbox2_slidedown_speed', t('You must enter a duration between 0 and 10 seconds.'));
      }

(only changed the <= and >= operators to < and >)

Any help would be greatly appreciated!

ball.in.th’s picture

setting the animation durations to 0.001 seems to work well. ^ ^

Jonasvh’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Version: 6.x-1.9 » 7.x-1.0-beta1
Status: Closed (fixed) » Active

In case it was really fixed: should it be ported to the D7 branch?

At least in 7.x-1.0-beta1 this bug still (or again) exists.

NB: I find it annoying that I can't find a patch here and would have to search the same bug again. So I adhere to #2.

Talkless’s picture

Why it's marked fixed? Same problem on Drupal 7