Embedding widgets on a HTML page
#
JavaScriptWidget service
Create a new Widgets instance pointing to a service:
Choose a widget
Choose which widget(s) you want to load:
#
CSSNote Widgets are using Twitter Bootstrap CSS framework.
#
Embedding mine widgets on a custom pageThe following describes how to embed widgets not in a mine context.
Open up a document in your text editor.
Use the InterMine JavaScript API Loader that always gives you the latest version of the widgets. In the
<head>
element of the page, add the following line:Load the Widget Service:
intermine.load
represents a block of code that loads the widgets by pointing them to a specific mine.Use the widget web service to view which widgets are available on the mine, eg:
http://beta.flymine.org/beta/service/widgets/
See which lists are available in the mine:
http://beta.flymine.org/beta/service/lists
``Add a widget (from the list in the previous step) to JavaScript. So within the
intermine.load
block, after creating theWidgets
instance, do this:Where the first parameter passed is either type of object or name of widget to load. The second is the name of list (public list) to access and third is an element on the page where your widgets will appear. This element needs to obviously exist on the page first. A common one is a div that would look like this:
<div id="all-widgets"></div>
.Add HTML, eg:
You will have noticed that the widgets either pickup a style (CSS) from your HTML page, or they appear unstyled. To style them, you can use a variant of Twitter Bootstrap.