With JSLink you have the ability to quickly and easily change how a list views and forms are rendered. Together with jQuery, CSS and even JavaScript you can present a SharePoint list in endless ways. In this example I will create a FAQ list with a accordion display style.
Solution
- Create a custom list called FAQ with a title and description field (Multiple Lines of Text).
- If required changed the fields to be shown.
- Create a page and add the FAQ web part to the page.
- Create the JSLink file called AccordionView.js
- Create the JavaScript file called accordion.js
- Create the CSS file called accordion.css
- Save the background image to SharePoint.
- Change the background-image URLs if needed.
- Link the JSLink to the web part to load the AccordionView.js.
- Add the accordion.js and accordion.css to the page, for example by using a Content Editor web part.
- Add jQuery to the page.
- Make sure that jQuery is loaded before the other JavaScript. Errors might otherwise be generated.