Hi,
I'm experimenting with adding GSAP animation within a WordPress theme.
I've added a few buttons, all with the same class, attached click events which control the scroll to next div.
Things work well in Safari, Firefox and Edge, but when I view my scrollTo tweens in Chrome, easing is ignored and there's a noticeable delay before scrolling even begins.
There's an example at:
http://testing-place.andrewmoreton.co.uk/
when the Click Me! button is clicked is scrolls and bounces nicely in the non-Chrome browsers, but is slow and doesn't bounce in Chrome!
This is driving me batty! I hope someone can help!
thanks.
Pasted below is my script:
// wait until DOM is ready
document.addEventListener("DOMContentLoaded", function(event) {
// wait until images, links, fonts, stylesheets, scripts, and other media assets are loaded
window.addEventListener("load", function() {
// add event listners for each button with
var all_next_section_buttons = document.querySelectorAll('.next-section-scroll');
for (var i = 0; i < all_next_section_buttons.length; i++) {
all_next_section_buttons.addEventListener('click', scrollToNextSection);
}
function scrollToNextSection() {
var next_section = this.closest('div.section').nextElementSibling;
gsap.to(window, {duration: 2, scrollTo:next_section, ease: "elastic"});
}
}, false);
});