Instead of copying all the example code here, you can check out the jQuery demo page:
Demo Page
I would like to integrate the Latest News example with scrolling text in red from the demo page into my website. The demo page also provides links to the source files for the examples.
Currently, my site has a script that reads text line by line from a file, scrolls it up on the screen, and displays a countdown timer until the next update.
I am looking to modify my code so that each line of text read from the file is added to the Latest News section on my site in a similar visual style as seen on the demo page.
Below is my existing working code. How can I achieve this integration with the Latest News example?
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://risq.github.io/jquery-advanced-news-ticker/assets/js/jquery.newsTicker.js"></script>
<script>
var count = 300;
var counter = setInterval(timer, 1000);
function timer() {
count = count - 1;
if (count == -1) {
clearInterval(counter);
return;
}
var seconds = count % 60;
var minutes = Math.floor(count / 60);
var hours = Math.floor(minutes / 60);
minutes %= 60;
hours %= 60;
document.getElementById("timer").innerHTML = hours + " Hours " + minutes + " Minutes and " + seconds + " Seconds left until the next news update.";
}
function news(){
$('body').find('.newsticker').remove();
var file = "http://newsxpressmedia.com/files/theme/test.txt";
$.get(file, function (txt) {
var lines = txt.split("\n");
$ul = $('<ul class="newsticker" />');
for (var i = 0, len = lines.length; i < len; i++) {
$ul.append('<li>' + lines[i] + '</li>');
}
$ul.appendTo('div.wcustomhtml').newsTicker({
row_height: 48,
max_rows: 2,
speed: 6000,
direction: 'up',
duration: 1000,
autostart: 1,
pauseOnHover: 1
});
});
}
$(function() {
news();
setInterval(function(){
news();
},30000)
});
</script>
<br><br><span id="timer"></span><br><br>
Do I have to download the demo example files or can I simply use a link like I did in my code?