I am using Mikael Svenson's script editor for the Modern UI in SharePoint Online. The code below seems to run without any errors, but there is no list items going across the page like the old HTML marquee used to do. Apologies for the code as I have been debugging it. Can anyone see what I am doing wrong. I am using REST to get the Announcement List Items - This all works and I get the List Item Body OK. I am trying to use the JQuery Marquee plugin.
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/jquery.marquee/1.3.1/jquery.marquee.min.js"></script>
<script type="text/javascript">
console.log("At start of REST Script");
$url = "https://<MyTenant>.sharepoint.com";
$.ajax({
url: $url +
"/_api/web/lists/getbytitle('Announcements')/items?select=*",
method: "GET",
headers: {
"Accept": "application/json; odata=verbose"
},
success: function(data) {
console.log("Success");
console.log(data.d.results);
var $dataArray = data.d.results;
for (var $i in $dataArray)
{
console.log(data.d.results[$i].Title);
var $str = $dataArray[$i].Body0;
var $gtindex = $str.indexOf(">");
$gtindex = $gtindex + 1;
$str1 = $str.substring($gtindex);
console.log($str.substring($gtindex));
var $ltindex = $str1.indexOf("<");
console.log($ltindex);
console.log($gtindex);
var $length = $ltindex -$gtindex;
var $innertext = $str1.substring(0,$ltindex);
console.log($innertext);
var $bodyHtml = "<li>" +$innertext + "</li>";
$("marquee").append($bodyHtml);
}
},
error: function(data) {
console.log("Failure");
alert(JSON.stringify(error));
}
});
$("#marquee").marquee();
console.log("At End of Script");
</script>
<ul id="marquee" class="marquee" />