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 6202869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:48:53+00:00 2026-05-24T04:48:53+00:00

Been working on implementing a scrolling news ticker into my site. Controlling the scrolling

  • 0

Been working on implementing a scrolling news ticker into my site. Controlling the scrolling function with JS. The code I am using is below, can anyone advise me on how to set and scrolling the speed at which the ticker will scroll?

$(function() {

    //cache the ticker to improve the performance of the page.  
    var ticker = $("#ticker");

    //wrap dt:dd pairs in divs to allow us to smooth our the animations
    ticker.children().filter("dt").each(function() {

      var dt = $(this),
        container = $("<div>");

      dt.next().appendTo(container);
      dt.prependTo(container);

      container.appendTo(ticker);
    });

    //hide the scrollbar
    ticker.css("overflow", "hidden");

    //animator function
    function animator(currentItem) {

      //work out new anim duration
      var distance = currentItem.height();
        duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.025;

      //animate the first child of the ticker
      currentItem.animate({ marginTop: -distance }, duration, "linear", function() {

        //move current item to the bottom
        currentItem.appendTo(currentItem.parent()).css("marginTop", 0);

        //recurse
        animator(currentItem.parent().children(":first"));
      }); 
    };

    // start the news section scrolling
    animator(ticker.children(":first"));

    // users mouse enters the scrolling view
    ticker.mouseenter(function() {

      // Im stopping the animation when the mouse enters
      ticker.children().stop();

    });

    // the mouse now leaves the view
    ticker.mouseleave(function() {

      // begin the animating again of the scroller
      animator(ticker.children(":first"));

    });
  });

Thanks

  • 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-05-24T04:48:54+00:00Added an answer on May 24, 2026 at 4:48 am

    Just copying and pasting JavaScript code can be dangerous stuff. Make sure you understand it before yanking it from a blog / tutorial. Also, have you tried anything yourself yet? Just reading the code should make the answer obvious:

    duration = (distance + parseInt(currentItem.css(“marginTop”))) / 0.025;

    Changing 0.025 to something else will change the duration of the animation.

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

Sidebar

Related Questions

I am using Ninject for implementing IoC/DI in my application. It has been working
I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have been working on some legacy C++ code that uses variable length structures
We've been working on implementing timezone support for our Web app. This great SO
I have been working on implementing the first 6 functions of the NSComparisonMethods protocol
I've been working on implementing a pretty complex system in JavaScript that needs to
I've been implementing the new unobtrusive javascript in my mvc 3 project (using RC1).
I've been working on implementing in-app billing, basing it off of blundell's tutorial here:
I been working on parsing out bookmarks from an export file generated by google
I have been working on a web services related project for about the last

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.