Search the Community
Showing results for tags 'addeventlistener'.
-
Hi, I am using the scrollToPlugin to scroll text automatically when banner loads. I need the scroll to pause when mouse enters the area and resume when it leaves. I am a newbie that needs help. Like I said the text scrolls automatically when banner loads but when I mouseenter it doesn't pause. Here is a sample of the code that I am using to accomplish my goal. I used a console.log to make sure everything is firing but still the scrolling text doesn't pause on mouse enter. I hope someone can help me understand what I am doing wrong. <script> function init() { box.play(); } var scroll = document.getElementById("box"); var _scrollDuration = 160; var tl = new TimelineMax(); tl.add(TweenLite.delayedCall(.5, startAutoScroll, [box, _scrollDuration])); scroll.addEventListener('mouseenter', function() { console.log('listening'); tl.paused(!tl.paused()); }); scroll.addEventListener('mouseleave', function() { console.log('listening'); tl.paused(!tl.paused()); }); </script>
- 5 replies
-
- startautoscroll
- tweenlite
-
(and 3 more)
Tagged with:
-
Hi. From inside the callback method of the addEventListener, is there a way to get a relative reference to the draggable instance? In the codepen, to retrieve the instance inside the options callback, I use "this". Using "this" inside the addEventListener callback retrieves the target element (not sure why because the listener is attached to the draggable instance). it would be preferable for me to use the addeventlistener way but in my situation I have many draggable instances and would like to access their properties and methods from inside the same callback. Let me know if that doesn't make sense. Thanks.