Triggering events outside the Hype document


(Joe) #1

Hello - I’m considering building an animation in Hype for a client site. The site requires that clicks within the animation trigger events on the rest of the page, and I want to confirm this is possible with the Hype js API? Thanks in advance.


(Joe) #2

Answering my own question: yes. When you create a function within Hype it binds it to the click event on your Hype element, and then you can select outside DOM elements from within that function, e.g.

function turnElementBlue ( hypeDocument, element, event ) {
	var myElement = document.getElementById('this-element');
	myElement.style.color = 'blue';
}