antoniandre / vue-cal

A Vue 2 & 3 full calendar, no dependency, no BS. :metal:
https://antoniandre.github.io/vue-cal
MIT License
1.2k stars 230 forks source link

Setting scroll top, only finds querySelector with multiple events. #565

Open sintesiNick opened 8 months ago

sintesiNick commented 8 months ago

public setScrollPosition(): void { if (this.$el) { console.log(this.$el.querySelector('.vuecalbg')); const bandStartTimes = this.events.map(band => new Date(band.start).getHours() * 60 + new Date(band.start).getMinutes()); this.$el.querySelector('.vuecalbg').scrollTop = ((Math.min(...bandStartTimes) - 60) / 60) * 40; } }

Using this code I'm setting the scrollTop of the calendar.

I'm using the querySelector for .vuecal__bg.

The weird part is that it only works with multiple events, not with 1 event, but when i go inside the code it is there. image

Anyone knows what could be causing this?

Multiple events: image

Single event: image image