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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:48:46+00:00 2026-05-22T01:48:46+00:00

I am trying to scroll text (list elements actually) from right to left. Here

  • 0

I am trying to scroll text (list elements actually) from right to left.

Here is HTML code

<div id="slider-txt">
    <ul>
        <li class="islide">text 1</li>
        <li class="islide">text 2</li>
    </ul>
</div>

my CSS

#slider-txt
{
position:relative;
width: 590px;
}

#slider-txt ul
{
list-style-type: none;
position: absolute;
margin: 0px;
padding: 0px;
}

#slider-txt ul li
{
text-align: right;
}

and the jQuery

var box = $('#slider-txt');
    if (box.length == 0) {
        return;
    }
var ul = box.find('ul');
    var li = $('#slider-txt').find('li');

    var liWidth = box.width();
    var ulWidth = liWidth * li.length;
    li.css('width', liWidth);
    ul.css('width', ulWidth);
    li.css('display', 'inline-block');
var liElement = 0;

    function slideNxt() {
        liElement++;
        if (liElement == li.length) {
            liElement = 0;
        }
    var curLeftPos = ul.css('left').split('px')[0];
    var newLeftPos = -(liElement * liWidth);
    ul.animate({ left: newOffset + 'px' }, { duration: 'slow', easing: 'swing' });
}
setInterval(slideNxt, 2000);

The above code swings the list items right to left and left to right in loop. The inline-block property set on list items don’t seem to work as expected (List items are displayed one below another). Also I want the list item to get hidden if it goes out of the box (div#slider-txt) width, which is not happening.

Can you please help me fixing these issues? 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-22T01:48:47+00:00Added an answer on May 22, 2026 at 1:48 am

    The CSS needs to be edited… and we will get the scrolling effect.

    #slider-txt
    {
       width: 590px;
       height: 20px;
       display:block;
       overflow:hidden; /* to hide the text */
       position: relative;
    }
    
    #slider-txt ul
    {
       list-style-type: none;
       margin: 0px;
       padding: 0px;
       position: absolute;
    }
    
    #slider-txt ul li
    {
       text-align: center;
       float: left; /* brings the list items in one line */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to unhide a DIV and then right after scroll down
I am trying to scroll text across the screen which is working well. Update
I am trying to move the following function listView_SelectionChanged away from code-behind and handle
I am trying to synchronize the horizontal scroll position of 2 WPF DataGrid controls.
I'm trying to recreate the iPhone flick / scroll event in a window using
Trying to make a make generic select control that I can dynamically add elements
I am trying to create a scrollable menu list in JavaScript and I am
I am trying to populate a list of images dynamically using javascript. I have
I'm trying to have a list of images displayed horizontaly. It's kind of like
I'm trying to write some JQuery using the AutoComplete plugin to display a list

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.