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

  • Home
  • SEARCH
  • 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 8735033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:57:45+00:00 2026-06-13T09:57:45+00:00

It seems when I make two calls to the function stockTicker() with seperate div

  • 0

It seems when I make two calls to the function stockTicker() with seperate div ID’s – the two tickers will not run smoothly and jump around:
http://jsfiddle.net/Tb6VY/

But if I only have one ticker it works fine:
http://jsfiddle.net/39JJ4/

Any ideas on how to get the first one to work?

Function:

( function($) {
    $.fn.stockTicker = function(options) {

        if (typeof (options) == 'undefined') {
            options = {};
        }

        var settings = $.extend( {}, $.fn.stockTicker.defaults, options);
        var $ticker = $(this);

        function startTicker() {
            //stopTicker();
            $firstElem = $ticker.children(":first");
            var $width = $firstElem.width();
            $ticker.stop().animate({
                "right": "+="+$width+"px"
            }, {
                duration: settings.speed*200,
                easing: 'linear',
                complete: function() {
                    $ticker.css({"right": "-="+($width)+"px"});
                    $firstElem.clone().appendTo($ticker);
                    $firstElem.remove();
                    startTicker();
                }
            });
        }

        function stopTicker() {
            $ticker.stop();
        }

        $ticker.hover(stopTicker, startTicker);
        startTicker();
    };

    $.fn.stockTicker.settings = {};
    $.fn.stockTicker.defaults = {
        tickerID :null,
        speed :1,
    };
})(jQuery);
  • 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-13T09:57:46+00:00Added an answer on June 13, 2026 at 9:57 am

    You forgot to declare $firstElem var, causing it to be treated as a “global” variable (and thus coming into conflict with the other ticker).

    After declaring var $firstElem = $ticker.children(":first");, the ticker works fine. Fiddle: http://jsfiddle.net/Tb6VY/2/

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

Sidebar

Related Questions

This seems to make perfect sense, but it is not working. I seem to
It seems that calling a P-Invoke while the App is not completed loaded make
It seems like a trivial problem, but nothing I've tried will make the background
i have make two global function now i want to call them in my
Seems when I make move refactoring all my junit tests lays on its old
It seems that both of them could make the element move from its current
It seems that I'm getting a conflict when trying to make a relationship because
This answer seems to show how to make a JSONObject. NSString *jsonString = @[{\id\:
Im trying to make an accordion with toggle which seems to work pretty good
When I make changes to a Flex project and rerun the project, it seems

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.