Ok, I did surgery and cut out the troubled piece and placed it in a lonely page so that you can examine it...
While doing so I found a third variant :-/
Background: What your going to see is part of a (German) website, an ongoing non-profit cultural project about a literary figure. The whole site is a replacement for a PHP4. website with some Flash from years ago, that went totally out of business some weeks ago...
So I've thrown together a wordpress based site as replacement and a video and text animation replacing a small Flash element much liked on the old site.
I wanted to build a HTML5 video player from scratch (with draggable handles) for a while and tested out the concept in the element in question in parts, but in a little hurry.
Under https://dev.thewebworks.de/debug/ you will find three variants of that element. One working, one not working at all and one breaking when dragging the volume handle. (You have to start the animation and hover over the volume icon in the lower right corner...) Sorry I couldn't provide those in a CodePen each, I just not proficient enough with the CodePen stuff and it would know how to make it work, if you cannot work with the links I'll be happy to send you a zip or even give it another try with CodePen.
All three share exactly the same (rusty) programming save one line (and changed class-names not to confuse VS-Code).
That line in the 'initVolumeControls' method is:
working:
this.volumeHandle = Draggable.create('#walk-volume-handle', { type: 'y', bounds: jQuery('#walk-volume-handle').parent(), onDrag:function(){
walk.react2VolumeHandleMove(this.y, this.maxY, this.minY);
throwing an error on initializing (not working):
this.volumeHandle = new Draggable('#walk-volume-handle', { type: 'y', bounds: jQuery('#walk-volume-handle').parent(), onDrag:function(){
walkB.react2VolumeHandleMove(this.y, this.maxY, this.minY);
throwing an error and breaking when dragging(partly working):
this.volumeHandle = Draggable.create('#walk-volume-handle', { type: 'y', bounds: jQuery('#walk-volume-handle').parent(), onDrag:function(){
walkC.react2VolumeHandleMove(this.y, this.maxY, this.minY)[0];
I'm rather sure that something with the scope of the anonymous onDrag function causes this behavior and I freely admit that one reason why I like to avoid those is, that in even in mildly complex situation understanding the scope sometimes makes my head explode.
Revisiting my hastily built stuff to isolate it for you I am sure that there are better ways to built this starting with the DOM and CSS. Also I regained a better understanding of gsap by now - I grew rusty in recent years. Still I am very curious how those three seemingly identical ways of trying to do the same thing have three different outcomes. Please enlighten me.