The developer api provides code that when you click the “Embed” button on each ‘NowSignage for Websites’ card can be directly placed inside the HTML markups of your website.
The code is composed of two parts, the first is a “script tag”, which looks similar to this:
<script src="https://cdn.nowsignage.com/for-websites/nowsignage-for-websites.min.js" charset="utf-8"></script>
This will grab a copy of our widget’s code to run on your site, this only needs to be placed in the webpage once, it can fit anywhere, but for performance reasons it’s usually placed before the</body>
tag, or within the<head>
and</head>
tags.
The second part of our embed code is a description of how to setup your selected ‘NowSignage for Websites’ configuration. That line looks similar to this:
<div class="nowsignage-for-web" data-api="f9727fd757bca10eb289cafe7fed0d9ce" data-scoop="customer-comments" async>
The code downloaded from the script tag will look for these “div tags” to construct the widget, place this div tag in a part of the page you want our widget to display.
We offer a limited API for performing operations on the widget once it has been loaded on a page, and where that page contains the jQuery library.
All you need to do is call NowSignage from the $(document).ready() function:
$(document).ready(function() { // Override the in-platform configuration, load five items at a time $(".nowsignage-for-web").nowsignage("setItemsPerPage", 5); // Call the "layout" function on all available widgets $(".nowsignage-for-web").nowsignage("layout"); });
All functions return a reference to the parent widget element, allowing the developer to chain function calls.
layout: Forces the layout engine to recalculate the positions of all items on the widget.
$(".nowsignage-for-web").nowsignage("layout");
loadMore: Loads the next page of results into the widget, simulating a user click on the “Load More” button
// Get the next page of results for all widgets: $(".nowsignage-for-web").nowsignage("loadMore");
setCTA: Changes the call-to-action text and URL.
// Each item CTA will say "Follow Us" and link to NowSignage.com $(".nowsignage-for-web").nowsignage("setCTA", {text: "Follow Us", url: "https://nowsignage.com"});
setItemsPerPage: Controls how many items will be shown on first load, and when the user clicks “Load More”
// Loads 12 items per page $(".nowsignage-for-web").nowsignage("setItemsPerPage", 12);
NowSignage Ltd. is a company registered in England and Wales. Registered number: 8424626
VAT registered in the UK: 158122617. Office: Landmark House, Station Road, Cheadle Hulme, Cheshire, SK8 7BS. © All rights reserved