Поделиться через


Scrolling News - javascript

This is a handy java script for anyone who would like to have Scrolling News (Vertical), Download the Java script file attached and follow the instructions below

1) Download the JavaScript File attached
2) Upload that file to a document library on the site you will be placing this script on
3) Take a note of the URL to the file

Then

1) On the site you want to put the scrolling text on, go to "Site Actions" > "Edit Page"
2) Click "Add Web part" on a zone of your choice (we will hide the web part anyhow so you won’t see where it is placed)
3) Select the " Content Editor" Web part and click OK
4) Click Edit > Modify Shared Web part
5) Select "Source Editor"
6) Paste the following code

<script src="https://yourdomainname.com/documents/newsscroller.js" type="text/javascript"></script>
<script type="text/javascript">
var scrollerMain = new NewsScroller("main");
</script>
<script type="text/javascript">
scrollerMain.AddNewsItem ("Learning Gateway", "https://www.learninggateway.com");
</script>
<div style="width: 150px; height: 150px;">
<script type="text/javascript">
scrollerMain.Render("floatingNews");
</script>
</div>
<script type="text/javascript">
scrollerMain.StartScrolling ();
</script>

* Remember to change the path that points to the javascript file you uploaded earlier*

To edit what links/content you want to scroll add the following

 </script>
<script type="text/javascript">
scrollerMain.AddNewsItem ("Name of Item 2", "https:// Hyper Link to News Item");
</script>

7) Once you have edited the source code to meet your needs, click SAVE

You will see the changed appear on the content area instantly, edit as you please and then once you are happy Publish the Page

James.