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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:33:07+00:00 2026-05-20T12:33:07+00:00

I found this question answered: jQuery Carousel How to show the Next or Previous

  • 0

I found this question answered: jQuery Carousel How to show the Next or Previous Element only. and have used the code to create a text feed.
The “next” and “previous” work, now I want to set it to loop through the feed onload, this is what I have come up with so far, but it is not working:


  $(function(ticker) {  

    $('#latest_news_ticker li').fadeOut(0);

    $('#latest_news_ticker li:first').fadeIn(500);

    $('a.leftarrow, a.rightarrow').click(function (ev) 

    {
        //prevent browser jumping to top
        ev.preventDefault();

        //get current visible item
        var $visibleItem = $('#latest_news_ticker li:visible');

        //get total item count
        var total =  $('#latest_news_ticker li').length;

        //get index of current visible item
        var index = $visibleItem.prevAll().length;

        //if we click next increment current index, else decrease index
        $(this).attr('href') === '#carouselNext' ? index++ : index--;

        //if we are now past the beginning or end show the last or first item
        if (index === -1){
           index = total-1;
        }
        if (index === total){
           index = 0
        }

        //hide current show item
        $visibleItem.hide();

        //fade in the relevant item
        $('#latest_news_ticker li:eq(' + index + ')').fadeIn(500);

        //after x seconds click next

    });

$(document).ready(function() {

var t = setInterval ( 'ticker()', 1000 ); 

});

});
  • 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-20T12:33:08+00:00Added an answer on May 20, 2026 at 12:33 pm

    For those who want to add a pause on hover:

    // JavaScript Document
        $(function(){
    $('#latest_news_ticker li').fadeOut(0);
    $('#latest_news_ticker li:first').fadeIn(500);
     var ticker = setInterval(nextone,3000);
    
    function nextone() {
        var $visibleItem = $('#latest_news_ticker li:visible');
        var total = $('#latest_news_ticker li').length;
        var index = $visibleItem.prevAll().length;
        $(this).attr('href') === '#carouselNext' ? index++ : index--;
        if (index === -1) {
            index = total - 1;
        }
        if (index === total) {
            index = 0
        }
        $visibleItem.hide();
        //fade in the relevant item
        $('#latest_news_ticker li:eq(' + index + ')').fadeIn(500);
    
    };
    
    $('#latest_news_ticker li a')
    .hover(
    function () {
    clearInterval(ticker)
    },
    function () {
    ticker = setInterval(nextone, 3000);
    }
    );
    
    
    $('a.leftarrow, a.rightarrow').click(
    
    function(ev) {
        ev.preventDefault();
        nextone();
        clearInterval(ticker);
        ticker = setInterval(nextone, 3000);
    });
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading this question I found this as (note the quotation marks) code to solve
While I found this question being answered here on SW several times, I didn't
I found this one question asking the same thing , however only the 'new'
I found this question in an old question in your website so i thought
I searched and found this question but did not like the answer. Is there
Just found this out, so i am answering my own question :) Use a
Similar to this question ... What are the worst practices you actually found in
I've asked this question over on the MSDN forums also and haven't found a
I haven't found an answer to this particular question; perhaps there isn't one. But
I searched for this and found Maudite's question about text editors but they were

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.