universal-tilt.js icon indicating copy to clipboard operation
universal-tilt.js copied to clipboard

Problem with base option

Open JB1905 opened this issue 6 years ago • 3 comments

@JB1905

v2.0.5 (v2.0.4) probably fixes this bug

Btw it probably produces a bug, when base option is set. With 2.0.3 and base works just fine. image Problem is here: image

Originally posted by @TemaSM in https://github.com/JB1905/universal-tilt.js/issues/38#issuecomment-502020090

JB1905 avatar Jun 16 '19 11:06 JB1905

@TemaSM I moved the conversation to the new issue. Could you provide additional information about settings, jQuery version, and whether you've attached platform library.

JB1905 avatar Jun 16 '19 11:06 JB1905

@JB1905 sorry for late reply, missed notifications.

jQuery: 3.4.1 universal-tilt.js: 2.0.4-2.0.5 Didn't attached platform as dependency into page before attaching universal-tilt.js, because there was no info about it in README.

$('.features .card').universalTilt({
    settings: {
      base: 'window',
      reverse: true,
      shine: false,
      max: 20,
      perspective: 900,
      speed: 1000,
      exclude: /(iPod|iPhone|iPad).* Safari/,
    },
  });

So, 2.0.6 fixed problem and base option works just fine as it was working in 2.0.3.

But, please pay attention to maybe another issue with base option. If we set base option value to be window, it produces errors with addEventListener: image and if we change value to 'window' (with quotes) it works without any problem. Should we improve this conditional?:

if (this.settings.base === 'window')

into

if (this.settings.base === 'window' || this.settings.base === window)

I think, that this situation a bit confusing. Because for example at my first time using universal-tilt.js I was thinking "Available options" for base means selector for element, but afterwards it became clear - available options ('element', 'window') are just const strings, like enums, not examples of selectors.

TemaSM avatar Jun 28 '19 02:06 TemaSM

Thanks for feedback. I'm working on version 2.1. The base option will be rebuilt (new values: window, all DOM elements on website). The update will be available next month. Preview of changes in v2.1

JB1905 avatar Jun 28 '19 08:06 JB1905