antoniandre / vue-cal-v4

A Vue.js full calendar, no dependency, no BS. :metal:
https://antoniandre.github.io/vue-cal-v4/
MIT License
1.25k stars 235 forks source link

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

Open sintesiNick opened 1 year ago

sintesiNick commented 1 year 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