Hello,
I am new in jquery maybe somebody can help me a little with that issue.
I have 2 files, one is just message text (msg.txt) that I would like to show on another my page in that place
<div id="marquee">
...
</div>
If I load message as:
function show(){
$('#marquee').load('msg.txt');
};
and trigger it:
$(document).ready(function(){
show();
msgrun();
setInterval('show()', 1000);
});
Its just display message as static but not running.
for running line I am using this code:
function msgrun() {
var marquee = $("#marquee"); marquee.css({"overflow": "hidden", "width": "100%"});
// оболочка для текста ввиде span (IE не любит дивы с inline-block)
marquee.wrapInner("<span>");
marquee.find("span").css({ "width": "50%", "display": "inline-block", "text-align":"center" });
marquee.append(marquee.find("span").clone());
// тут у нас два span с текстом
marquee.wrapInner("<div>");
marquee.find("div").css("width", "200%");
var reset = function() { $(this).css("margin-left", "0%");
$(this).animate({ "margin-left": "-100%" }, 12000, 'linear', reset); };
reset.call(marquee.find("div"));
};
If I have predefined message between tags:
<div id="marquee">
Test message to show
</div>
its works fine and move, but once I load message from file - not, that I am doing wrong here?