felixhagspiel / jsOnlyLightbox

Responsive Lightbox in plain JS. No need for jQuery.
MIT License
157 stars 51 forks source link

Setting animation option to false doesn't work #27

Closed rmilecki closed 8 years ago

rmilecki commented 8 years ago

Documentation quote:

Passing false disables the animation.

However doing lightbox.load({animation: false}); doesn't work. Lightbox still uses 400ms animation.

This is caused by the following part of code: animation: opt.animation || 400, which picks 400 number value in case of passing false.

I believe above line should be changed to: animation: typeof opt.animation === 'number' || opt.animation === false ? opt.animation : 400,

Proposed code treats false as disabled animation, true as default animation time (400 ms) and any numeric value as custom animation time.

felixhagspiel commented 8 years ago

totally right. Thanks!