I am very grateful for the help based on the following image:
![enter image description here](https://fooobar.com//img/552dfae17cfd920711764bcb67acf34e.gif)
Also, I'm trying to do (infinite) scrolling of green text in a div.title-holder
. My goal is to scroll only with mouseOver and then reset to mouseOut div.container
. I thought it would be a simple task with a little CSS and jQuery, but apparently this is not the case. Here is my HTML, CSS and the accompanying JS:
<div class="container"> <div class="title-holder"> <a href="somelink.html">long text that needs to scroll</a> </div> <img src="someimage.jpg" /> </div>
Matching CSS:
div.title-holder { width:130px; height:20px; overflow:hidden; white-space:no-wrap; text-align:center; } div.title-holder a { }
jQuery JS:
$('div.container').hover( function () { var scrollingWidth = $(this).find('div.title-holder').find('a').width(); $(this).find('div.title-holder').stop(true, true).animate({scrollLeft: scrollingWidth}, { duration: 5000, easing: 'swing' }); }, function () { $(this).find('div.title-holder').stop(true, true).animate({scrollLeft: 0}, { duration: 5000, easing: 'swing' }); } );
Now this works fine, except for two problems:
- It does not scroll endlessly, but
- The scroll action is very heavily overloaded / jittery
I really hope someone had a similar requirement in the past and can shed light on this issue for me. Thanks!
source share