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

I found this question which answered most of my question, however I have a
I found this question but it was only similar and, more importantly, dated by
I have found this question; Can I move a Flash object within the DOM
While I found this question being answered here on SW several times, I didn't
This is a expansion on to a previous question that got answered yesterday, which
This should be an easy question I figure, but I hadn't found this answered
I've read around and found this answered question about a problem relating to this
I've seen this question asked here but I haven't found one that is answered
I found this one question asking the same thing , however only the 'new'
In another question answered here I found the following JavaScript code: function _dom_trackActiveElement(evt) {

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.