Added scroller to sharepoint news webpart
To add a scroller to a SharePoint News Web Part, you can use the following methods:
Method 1: Using the SharePoint News Web Part settings
- Go to your SharePoint site and navigate to the page where you want to add the scroller.
- Click on the News Web Part and click on the gear icon () to open the Web Part settings.
- In the Web Part settings, click on the "Appearance" tab.
- Under "Layout", select "Scroller" from the dropdown menu.
- Choose the scroller style and settings you want to use.
- Click "OK" to save the changes.
Method 2: Using a third-party scroller control
- Go to your SharePoint site and navigate to the page where you want to add the scroller.
- Click on the News Web Part and click on the gear icon () to open the Web Part settings.
- In the Web Part settings, click on the "Advanced" tab.
- In the "Advanced" tab, click on the "Web Part Properties" button.
- In the "Web Part Properties" dialog box, click on the "Add a new property" button.
- Enter the name of the property (e.g. "Scroller") and select "String" as the data type.
- Enter the URL of the scroller control (e.g. a JavaScript file) in the "Value" field.
- Click "OK" to save the changes.
- Go back to the page and refresh it to see the scroller in action.
Method 3: Using a custom solution
- Create a custom SharePoint solution using SharePoint Framework (SPFx) or SharePoint Designer.
- Add a scroller control to your custom solution using HTML, CSS, and JavaScript.
- Deploy the custom solution to your SharePoint site.
- Add the custom solution to your page and configure it to display the News Web Part.
Here is an example of how you can add a scroller to a SharePoint News Web Part using SPFx:
import { WebPart } from '@microsoft/sp-webpart-base';
import { Scroller } from 'scroller-js';
export class NewsWebPart extends WebPart<INewsWebPartProps> {
private scroller: Scroller;
protected onInit(): Promise<void> {
this.scroller = new Scroller({
container: this.domElement,
items: this.newsItems,
itemTemplate: this.newsItemTemplate,
scrollerStyle: 'horizontal'
});
return Promise.resolve();
}
protected onRender(): void {
this.scroller.render();
}
}
Note: The above code is just an example and you will need to modify it to fit your specific requirements.