Skip to content

Instantly share code, notes, and snippets.

@rdswd
Created April 1, 2020 03:49
Show Gist options
  • Select an option

  • Save rdswd/9485c41f3a03563859f36f1d67fedb90 to your computer and use it in GitHub Desktop.

Select an option

Save rdswd/9485c41f3a03563859f36f1d67fedb90 to your computer and use it in GitHub Desktop.
ScrollMagic - inline styles for transformations
//cont
var buttonAnimate = new ScrollMagic.Scene({triggerElement: ".wp-block-button__link"} )
.offset(-100)
.on("enter", function (evt) {
buttonAnimate.triggerElement().style.backgroundColor = 'red';
buttonAnimate.triggerElement().style.fontSize = '125%';
})
.on("leave", function () {
// reset style
buttonAnimate.triggerElement().style.backgroundColor = '';
buttonAnimate.triggerElement().style.fontSize = '';
})
.addIndicators({name: "2 - change inline style"}) // add indicators (requires plugin)
.addTo(controller);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment