Hi @Max
I could use a JS that scrolls up when the question is clicked.
So the question is always aligned at the top. Is that possible?
Hi @Max
I could use a JS that scrolls up when the question is clicked.
So the question is always aligned at the top. Is that possible?
Hi there, @Sina ![]()
Currently, if you choose a specific question, the widget scrolls up to it a bit by default and this question is always displayed at the top:
Could you please describe your idea in more detail?
Hi @Max
No problem. You’re right. The widget scrolls up a bit. But that’s not enough for me if the answer contains more content. Check out my account. I’ve converted the FAQ widget into a nice pricing table (answer area). It would be great if it scrolled up a bit more.
I’ve checked your test widget and see that the scroll moves up to the highest point when clicking the question.
Could you please double-check it?
test again, now with the correct widget width ![]()
Hmm, the scroll still moves to the highest position:
Hmm, It doesn’t work for me. I’ve tried Chrome and Firefox.
Ah, it seems there was some misunderstanding!
From your screencast, I see the scroll was at the top position and then you’ve clicked on the 3rd question and the scroll hasn’t moved. You want the scroll to move down when clicking on the question below, am I right?
@Max Maybe you meant it the other way around. I wrote “scroll up” but meant “scroll down.” ![]()
Yep, got it! I’ll check with the devs if anything can be done ![]()
@Max Not just for the third question. For everyone.
I’ve updated the widget. Take a look at the last question. Only three lines of the answer are visible.
Okay, our devs will try to customize the widget this way for all questions ![]()
Hi @Sina ![]()
We’ve added this script to the Custom JS field of your widget:
/* scroll opened question into view */
document.addEventListener('click', (e) => {
const faqItem = e.target.closest('.eapps-faq-content-category-item');
if (faqItem) {
setTimeout(() => {
faqItem.scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 300);
}
});
Please check it out and let me know if you like the result ![]()
Hi @Max very nice this script. Thank you for this. ![]()
I’ll test it to understand it.
Maybe I can fine-tune it a bit, because it scrolls a bit too far down. The question is being over-scrolled.
@Sina Do you mean the cases, when the scroll moves a bit lower than expected and the question disappears, but in a second it shows up again, right?
Ah, I see now, thanks!
I’ll double-check it with the devs ![]()
The script is working correctly, but the questions got cropped because of your website’s menu. The new script adds some padding, and the questions don’t disappear now ![]()
/* scroll opened question into view */
const topBannerHeight = 37;
document.addEventListener('click', (e) => {
const faqItem = e.target.closest('.eapps-faq-content-category-item');
if (faqItem) {
setTimeout(() => {
const faqItemRect = faqItem.getBoundingClientRect();
window.scrollTo({
top: faqItemRect.top + window.scrollY - topBannerHeight,
behavior: 'smooth',
});
}, 300);
}
});
Could you please check it?
@Max now is PERFECT ! Thanks
![]()
Great, you’re very welcome ![]()