Click here to Skip to main content
13,451,557 members (45,092 online)
Click here to Skip to main content
Add your own
alternative version


4 bookmarked
Posted 18 Nov 2012

A simple ticker with jQuery

, 19 Nov 2012
Rate this:
Please Sign up or sign in to vote.
Simple vertical scroller.


This is a very simple scroller script that can be added to any HTML page. This Example has been tested and is compatible in IE, Netscape, Firefox, and Opera browsers.


This example is being done using the jQuery framework.

Using the code

HTML Structure
<div id="tickerwrapper">
    <div class="container">
            <li>1 </li>
            <li>2 </li>
            <li>3 </li>
            <li>4 </li>
            <li>5 </li>
            <li>6 </li>


ul li{list-style:none}
#tickerwrapper ul li{padding:5px;text-align:center}
#tickerwrapper .container{background:#ccc;height:31px;overflow:hidden;width:150px;} 

JavaScript code

var containerheight = 0;
var numbercount = 0;
var liheight;
var index = 1;

function callticker() {    
    $(".container ul").animate({
        "margin-top": (-1) * (liheight * index)
    }, 2500);
    if (index != numbercount - 1) {
        index = index + 1;
    else {
        index = 0;
    timer = setTimeout("callticker()", 100);
$(document).ready(function() {
    numbercount = $(".container ul li").size();
    liheight = $(".container ul li").outerHeight();
    containerheight = $(".container ul  li").outerHeight() * numbercount;
    $(".container ul").css("height", containerheight);
    var timer = setTimeout("callticker()", 100);

View this example

Click here 


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Raghav Nayak
Web Developer
India India
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...

Comments and Discussions

QuestionNumber Ticker Pin
Link Worx Seo23-Apr-13 3:47
professionalLink Worx Seo23-Apr-13 3:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180318.3 | Last Updated 19 Nov 2012
Article Copyright 2012 by Raghav Nayak
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid