Skip to content Skip to sidebar Skip to footer

Jquery Horizontal News Ticker Using Google Jsapi

I need to make some changes to this news ticker which is based on goldyberg's jquery horizontal newsticker using Google JSAPI: http://inetwebdesign.com/jQueryTools/tickers/horizont

Solution 1:

  1. To limit the words, use entries[i].title
  2. To display the date, use entries[i].publishedDate, add a reference to the Datejs open-source JavaScript date library http://www.datejs.com on your HTML file and modify the provided javascript.

A demo is here: http://www.marlenynunez.com/files/jsapi/horizontal-news-ticker4.html

HTML file:

    <script type="text/javascript" src="js/date.js"></script>
    <script type="text/javascript" src="js/scripts.js"></script>

scripts.js file:

    parse: function(entries) {
        var feedMarkup = '';
        var pubDate;
        var titleText;
        var splitText;
        feedMarkup += '<ul>';
        for (var i = 0; i < entries.length; i++) {
            titleText = entries[i].title;
            splitText = titleText.substring(0,60).split(" ");
            titleText = splitText.slice(0, -1).join(" ") + '...';
            pubDate = Date.parse(String(entries[i].publishedDate)).toString('MMM dd');
            feedMarkup += '<li>'+pubDate+' | <a target="_blank" href="'+entries[i].link+'">'+titleText+'</a></li>'; 
        }   

Post a Comment for "Jquery Horizontal News Ticker Using Google Jsapi"