WordPress.org

Ready to get started?Download WordPress

Forums

WP-Newsticker
News ticker is not looping (10 posts)

  1. rakeshjuneja
    Member
    Posted 2 years ago #

    Hi,
    The news ticker is not looping , means it shows posts title only once and does not run in loop.
    URL is english.samaja.in
    Regards

    http://wordpress.org/extend/plugins/wp-newsticker/

  2. dikoro
    Member
    Posted 2 years ago #

  3. dikoro
    Member
    Posted 2 years ago #

    sorry that did not solve it for me too. Now i just found out that have the same issue. Please anyone who know codes please help.

  4. rakeshjuneja
    Member
    Posted 2 years ago #

    Ok Below is the full code that i used and it worked, you can copy an paste it but be sure to backup your original jquery.newsticker.js
    /*
    * This is a simple JavaScript vertical scroller that is crossbrowser and also validates
    * as XHTML Strict.
    *
    * Usage:
    * (1) Define a <div> tag with a specified ID, containing the scrolling text. One <div> for each line.
    * (2) Define an INLINE CSS width and height (important, MUST be inline)
    * (3) Execute the divScroller function, passing id, mode (h or v), speed (higher number means
    * slower) and delay (in ms).
    *
    */

    /****************************************************************************************************
    * Cross browser getElementByID.
    * From: http://www.quirksmode.org
    *
    * @param id
    */
    function getObj(name)
    {
    if (document.getElementById)
    {
    this.obj = document.getElementById(name);
    this.style = document.getElementById(name).style;
    }
    else if (document.all)
    {
    this.obj = document.all[name];
    this.style = document.all[name].style;
    }
    else if (document.layers)
    {
    this.obj = document.layers[name];
    this.style = document.layers[name];
    }
    }

    /****************************************************************************************************
    * Enables the scrolling for the specified div (matching id).
    *
    * @param string id of the tag
    * @param speed
    * @param delay
    */
    function divScroller(id, direction, speed, delay)
    {
    if (document.getElementById)
    {
    // DOM3 = IE5+, NS6+, FF0.7+
    // *** Scroller
    var scroller = new getObj(id);

    // *** Debug force vars
    //scroller.style.height = "30px";
    //scroller.style.backgroundColor = "#FFEEEE";

    // *** Computed Styles
    //alert(scroller.obj.currentStyle.height);
    /*if (!scroller.style.height)
    if (scroller.obj.currentStyle)
    scroller.style.height = scroller.obj.currentStyle.height;
    else
    scroller.style.height = document.defaultView.getComputedStyle(scroller.obj, null).getPropertyValue("height");*/

    // *** Needed vars
    scroller.style.position = "relative";
    scroller.style.overflow = "hidden";

    // *** Generate scrolling inner <div>
    scroller.obj.innerHTML = "<div id=\"" + id + "_inner\">" + scroller.obj.innerHTML + "</div>";

    // *** Inner
    var inner = new getObj(id + "_inner");
    inner.style.position = "absolute";
    inner.style.left = parseInt(scroller.style.width) + "px";
    inner.style.top = parseInt(scroller.style.height) + "px";

    // *** Apply sub-styles
    //divScrollItemsStyler(id, direction);

    // *** Worker
    if (direction == "h" || direction == "horizontal")
    {
    // ****** HORIZONTAL
    // MouseOver: pauses the ticker
    scroller.obj.onmouseover = function() { divScroll_onMouseOver(id); };
    scroller.obj.onmouseout = function() { divScroll_onMouseOut(id); };

    // Create a temp element to evaluate the size (awful, but no better way to do this)
    fxpatch = navigator.userAgent.indexOf("Firefox") > -1 ? " left: -9000px;" : ""; // Firefox different CSS (on every other browser since IE5+ isn't needed)
    spanContent = "<span id=\"" + id + "_widthEval\" style=\"visibility: hidden; position: absolute; top: -100px; left: -1px; z-index: -10; white-space: nowrap;" + fxpatch + "\"><nobr>" + inner.obj.innerHTML + "</nobr></span>";
    if (document.createElement)
    {
    var span = document.createElement('span');
    span.innerHTML = spanContent;
    scroller.obj.appendChild(span);
    }
    else
    {
    document.write(spanContent);
    }
    var widthEval = new getObj(id + "_widthEval");

    // Setup the scrolling inner drawer
    inner.style.top = "0px";
    inner.style.whiteSpace = "nowrap";
    inner.style.width = widthEval.obj.offsetWidth + "px";
    limit = parseInt(inner.style.width);

    // Execute
    setTimeout("divScrollHelperH(\"" + id + "\", " + limit + ", " + speed + ", " + delay + ")", parseInt(speed));
    }
    else if (direction == "v" || direction == "vertical")
    {
    // ****** VERTICAL
    // Setup the scrolling inner drawer
    inner.style.left = "0px";
    inner.style.width = parseInt(scroller.style.width) + "px";
    limit = inner.obj.getElementsByTagName('div').length * parseInt(scroller.style.height);

    // Execute
    setTimeout("divScrollHelperV(\"" + id + "\", " + limit + ", " + speed + ", " + delay + ")", parseInt(speed));
    }
    }
    }

    /****************************************************************************************************
    * Helper for the HORIZONTAL scrolling for the specified div (matching id).
    * This is the real "ticker" function, executed to move the div.
    *
    * @param string id of the tag
    * @param pre-calculated height limit (to speed up execution)
    * @param speed
    * @param delay
    */
    function divScrollHelperH(id, limit, speed, delay)
    {
    if (document.getElementById)
    {
    // DOM3 = IE5+, NS6+, FF0.7+
    var scroller = new getObj(id);
    var inner = new getObj(id + "_inner");

    // *** Tick duration
    nextTick = speed;

    // *** Avoiding some errors
    if (!inner.style.left) inner.style.left = "0px";

    // *** Moving the inner div. At the end, restart.
    if (parseInt(inner.style.left) < -limit)
    {
    inner.style.left = "500px";
    }
    else if (!scroller.obj.pause || scroller.obj.pause == false)
    {
    inner.style.left = (parseInt(inner.style.left) - 1) + "px";

    // Deceiving Opera8 stupidity
    //inner.style.width = parseInt(scroller.style.width) - (parseInt(inner.style.left) - 4) + "px";
    }

    // *** Bigger delay on item found
    // Skips borders to make transition without delays on loop
    /*if (!(parseInt(inner.style.left) == parseInt(scroller.style.width)) &&
    !(parseInt(inner.style.left) == -limit) &&
    (parseInt(inner.style.left) % parseInt(scroller.style.width)) == 0)
    {
    nextTick = delay;
    }*/

    // *** Tick!
    setTimeout("divScrollHelperH(\"" + id + "\", " + limit + ", " + speed + ", " + delay + ")", parseInt(nextTick));
    }
    }

    /****************************************************************************************************
    * Helper for the VERTICAL scrolling for the specified div (matching id).
    * This is the real "ticker" function, executed to move the div.
    *
    * @param string id of the tag
    * @param pre-calculated height limit (to speed up execution)
    * @param speed
    * @param delay
    */
    function divScrollHelperV(id, limit, speed, delay)
    {
    // DOM3 = IE5+, NS6+, FF0.7+
    var scroller = new getObj(id);
    var inner = new getObj(id + "_inner");

    // *** Tick duration
    nextTick = speed;

    // *** Avoiding some errors
    if (!inner.style.top) inner.style.top = "0px";

    // *** Moving the inner div. At the end, restart.
    if (parseInt(inner.style.top) < -limit)
    {
    inner.style.top = parseInt(scroller.style.height) + "px";
    }
    else
    {
    inner.style.top = (parseInt(inner.style.top) - 1) + "px";
    }

    // *** Bigger delay on item found
    // Skips borders to make transition without delays on loop
    if (!(parseInt(inner.style.top) == parseInt(scroller.style.height)) &&
    !(parseInt(inner.style.top) == -limit) &&
    (parseInt(inner.style.top) % parseInt(scroller.style.height)) == 0)
    {
    nextTick = delay;
    }

    // *** Tick!
    setTimeout("divScrollHelperV(\"" + id + "\", " + limit + ", " + speed + ", " + delay + ")", parseInt(nextTick));
    }

    /****************************************************************************************************
    * OnMouseOver helper for the HORIZONTAL scrolling for the specified div (matching id).
    *
    * @param string id of the tag
    */
    function divScroll_onMouseOver(id)
    {
    var scroller = new getObj(id);
    scroller.obj.pause = true;
    }

    function divScroll_onMouseOut(id)
    {
    var scroller = new getObj(id);
    scroller.obj.pause = false;
    }

    /****************************************************************************************************
    * Apply essential working styles to each <div> inside the scroller.
    *
    * @param string id of the inner div
    */
    function divScrollItemsStyler(id, direction)
    {
    // DOM3 = IE5+, NS6+, FF0.7+
    var scroller = new getObj(id);
    var inner = new getObj(id + "_inner");

    elements = inner.obj.getElementsByTagName('div');

    for (var i = 0; i < elements.length; i++)
    {
    var item = elements.item(i);

    item.style.width = scroller.style.width;
    }
    }

  5. rakeshjuneja
    Member
    Posted 2 years ago #

    or if you want only changes mentioned line 150 to 157
    here it is , you can choose to copy the entire code as given above or try to see if these only solves the problem.
    // *** Moving the inner div. At the end, restart.
    if (parseInt(inner.style.left) < -limit)
    {
    inner.style.left = "500px";
    }
    else if (!scroller.obj.pause || scroller.obj.pause == false)
    {
    inner.style.left = (parseInt(inner.style.left) - 1) + "px";

  6. dikoro
    Member
    Posted 2 years ago #

    @rakeshjuneja

    wow! thanks i will give it a try, hope it works. thanks

  7. dikoro
    Member
    Posted 2 years ago #

    @rakeshjuneja

    YES!! YOU ARE THE MAN! IT WORKS now.!!!

    Many Many Thanks!

  8. anjoalre
    Member
    Posted 2 years ago #

    Or for all sizes, not just "500px"

    change line 154:
    inner.style.left = parseInt(scroller.style.width) + "px";
    to:
    inner.style.left = parseInt(inner.style.width) + "px";

  9. dreamsight
    Member
    Posted 2 years ago #

    Thanks, its worked for me too

  10. felix80
    Member
    Posted 2 years ago #

    i guys, that's fine but it does not work in Internet explore 7 and 8 do you know why?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic