Ignoring a scene when using scrolling javascript

(Nigel) #1

Hi there. I’m currently using javascript to listen for mouse scroll direction and then transition to a new scene. But, is there anyway I can omit certain scenes that can be scrolled to?

if (window.addEventListener) {
window.addEventListener("mousewheel", scrollScene, false);
window.addEventListener("DOMMouseScroll", scrollScene, false);

function scrollScene(e){

	var upORdown = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
if(upORdown === 1){
hypeDocument.showPreviousScene(hypeDocument.kSceneTransitionPushTopToBottom, 0.5)
hypeDocument.showNextScene(hypeDocument.kSceneTransitionPushBottomToTop, 0.5)



For this line: if(upORdown === 1){

You can add a condition so that it wouldn’t run if the current scene name is X :

if(upORdown === 1 && hypeDocument.currentSceneName() != 'Scene Name'){

This would require that this function is run on scene load for each scene, since it needs to know the ‘current’ scene name on each run.

(Nigel) #3

Thanks very much :smile: