Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8187795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:40:55+00:00 2026-06-07T02:40:55+00:00

I have a a element that I want to scroll left on hover. To

  • 0

I have a “a” element that I want to scroll left on hover. To do this I remove the first character and append it to the end of the string.

How can I continuously fire up the scroll function?

Mouse enters element -> scroll() is fired until mouse leaves the element or user clicks on it.

html:

<a href="foo.htm" class="scrollthis">this text scrolls on hover</a>

jQuery:

$(".scrollthis").hover(function(){
    scroll($(this));

});

function scroll(ele){

    var s = $(ele).text().substr(1)+$(ele).text().substr(0,1);
    $(ele).text(s);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:40:57+00:00Added an answer on June 7, 2026 at 2:40 am

    Use setInterval() to call it repeatedly from mouseenter, then clearInterval() to stop it on mouseleave:

    var intervalID;
    $(".scrollthis").hover(function(){
        var $this = $(this);
        intervalID = setInterval(function() {
           scroll($this);
        }, 100);
    }, function() {
        clearInterval(intervalID);
    });
    

    Note that you don’t need to use $(ele) in your scroll() function because ele is already a jQuery object:

    function scroll(ele){
        var s = ele.text().substr(1)+ele.text().substr(0,1);
        ele.text(s);
    }
    

    Demo: http://jsfiddle.net/hTBZn/

    You can make your scroll() function a bit neater if you use the callback syntax of the .text() method (or even move that one line directly into the .hover code):

    function scroll(ele){
        ele.text(function(i,val) { return val.substr(1) + val.substr(0,1); });
    }​
    

    Demo: http://jsfiddle.net/hTBZn/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a container element that you can drag objects around in. I want
I have an image that I want to move. I can move the element
I want to have a element that displays in the multiple selection display style
I have a UserControl with a Border element within it that I want to
I currently have links w/ class=ajax that I want to retrieve the element with
I have an <li> element on the page that I want to look a
I want to parse xml files that have elements like these: <element>&amp</element> <element>&amp;</element> But
I have a script that create a new div element. Then, I want to
i have a working script, that allows me to scroll inside a -element, while
i have a element, that i want to be disabled in a situation. ok.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.