Hi all,
It's been a while, I'm still very happy with Hype!
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... )
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.)