midzer / tobii

An accessible, open-source lightbox with no dependencies
https://midzer.github.io/tobii/demo/
MIT License
196 stars 20 forks source link

Multiple instances does not work #74

Closed viliusle closed 3 years ago

viliusle commented 3 years ago

Multiple instances of Tobii does not work. Last will work, others - not.

Example:

<a href="https://img.youtube.com/vi/HHi8qOtHnhE/maxresdefault.jpg" class="first" data-group="first">
   First - this will not work
</a>
<a href="https://img.youtube.com/vi/HHi8qOtHnhE/maxresdefault.jpg" class="second" data-group="second">
   Second - this will work
</a>
const tobii_first = new Tobii({
  selector: '.first'
})
const tobii_second = new Tobii({
  selector: '.second'
})

This can be issue, when you want to track events, right now you get event from all objects, without knowing which exactly. (separate bug)

midzer commented 3 years ago

I am unsure whether we want/can support multiple tobii instances.

Whats an exact use case?

viliusle commented 3 years ago

For example because of this bug: https://github.com/midzer/tobii/issues/75 But if we fix it, this becomes low priority or closed I guess. Another idea is show console warning about multiple instances, so devs don't waste time doing it and not getting result they want?