Mouse scrolling text in a widget loaded hype document

Hi all,
It's been a while, I'm still very happy with Hype! :heart:

Maybe someone can help me with this, be aware I (sadly) still have no knowledge about javascript.

I'm loading an Hype html document into a widget. The widget has buttons, that with the help of this forum, loads and switches these Hype documents in and out of the widget.

These loaded in documents have large text fields. I've added a scrollbar and up & down buttons to scroll these texts up & down but it's not enough for some and they want to be able to scroll the text field by the middle mouse button too! (spoiled people... :sweat_smile:)

I'm using this function to scroll the mousewheel,

var time = hypeDocument.currentTimeInTimelineNamed('timelineName');

///// scroll timeline
function wheel(event) { // Firefox
	event.preventDefault();
	if (event.wheelDeltaY > 0 && time > .01) {
		//console.log("up");
		time -=.02;
		
		hypeDocument.goToTimeInTimelineNamed(time, 'timelineName');

	} else if (time < 12) {
		//console.log("down");
		time +=.02;
		hypeDocument.goToTimeInTimelineNamed(time, 'timelineName');
	}
}


function wheel2(event) { // other browsers
	event.preventDefault();
	if (event.detail < 0 && time > .01) {
		//console.log("up");
		time -=.02;
	
		hypeDocument.goToTimeInTimelineNamed(time, 'timelineName');

	} else if (time < 12) {
		//console.log("down");
		time +=.02;
		hypeDocument.goToTimeInTimelineNamed(time, 'timelineName');
	}
}


window.onmousewheel = document.onmousewheel = wheel;
window.addEventListener("DOMMouseScroll", wheel2, false);
document.addEventListener("DOMMouseScroll", wheel2, false);

This works on a normal Hype document when placed into the 'Scene' tab on 'Prepare For Display'.

But when I load that same document with the above working function into a widget it stops working.

Is there any way to get this working again? (And gosh I really hope I did not ask this before, it's really a long time since I posted here.) :face_in_clouds:

I think you need to call Hype from the outside: Tumult Hype Documentation

You first need to call the Hype document

Can’t look at this at mo,
But suspect that because you are putting it in a widget, the widget has no idea what the hypeDocument Is.

Widgets are basically iframes…

I was that far in figuring this out. :slight_smile: but how to proceed now?

I know about the iFrame part. :slight_smile: I also understand that by loading another frame into it, things work differently.

It maybe isn't possible, which means people need to work what I have at hand now. There's no rush here btw :sweat_smile:. It would be great if it works, if not no human overboard. :sweat_smile: