The `oShare.open` open event fires when a social network share action is triggered, to open a new window.
property | type | description |
---|---|---|
share | The o-share instance. | |
action | The kind of share i.e. "social". | |
url | The social share url opened. |
The `oShare.ready` fires when a o-share instance has been initialised.
property | type | description |
---|---|---|
share | The initialised o-share instance. |
parameter | type | default | description |
---|---|---|---|
rootEl | HTMLElement | string | [el=document.body] - Element where to search for an o-share component. You can pass an HTMLElement or a selector string | |
config | object | Optional | |
config.url | string | Optional, url to share | |
config.title | string | Optional, title to be used in social network sharing | |
config.titleExtra | string | Optional, extra bit to add to the title for some social networks | |
config.summary | string | Optional, summary of the page that's being shared | |
config.relatedTwitterAccounts | string | Optional, extra information for sharing on Twitter | |
config.links | Array.<object> | Optional, array of strings of supported social network names that you want rendered |
Initialises the Share class, rendering the o-share element if it's empty with config options, or from corresponding data attributes and sets up dom-delegates. Dispatches 'oShare.ready' at the end
Destroys the Share instance, disables dom-delegates
Initialises all o-share components inside the element passed as the first parameter
parameter | type | default | description |
---|---|---|---|
rootEl | HTMLElement | string | [el=document.body] - Element where to search for o-share components. You can pass an HTMLElement or a selector string |
parameter | type | default | description |
---|---|---|---|
rootEl | HTMLElement | string | [el=document.body] - Element where to search for an o-share component. You can pass an HTMLElement or a selector string | |
config | object | Optional | |
config.url | string | Optional, url to share | |
config.title | string | Optional, title to be used in social network sharing | |
config.titleExtra | string | Optional, extra bit to add to the title for some social networks | |
config.summary | string | Optional, summary of the page that's being shared | |
config.relatedTwitterAccounts | string | Optional, extra information for sharing on Twitter | |
config.links | Array.<object> | Optional, array of strings of supported social network names that you want rendered |
If using the Build Service, add o-share@^8.3.0
to your
script and link tags.
If using the npm package manager for a Manual Build, run npm install --save-peer "@financial-times/o-share@^8.3.0"
.
o-share is maintained directly by the Origami team. If you have any questions about o-share or Origami in general, we are happy to help. 😊
Slack: #origami-support
Email: origami.support@ft.com
To report a bug or request features please create an issue on Github. For support or general feedback please get in touch 😊
Slack: #origami-support
Email: origami.support@ft.com