An OpenStoriesFeed viewer. See it in action on muan.co.
Usage
<script src="https://unpkg.com/[email protected]" type="module" defer>script>
<open-stories src="./feed.json">open-stories>
This requires native and Shadow DOM support. No polyfills included.
Parts
Style elements with ::part
(MDN):
Button
open-stories::part(button)
is the selector for the that opens the story modal. It would be good to style
open-stories:not(:defined)
the same way, to prevent style flashing as the script executes.
Advanced
open-stories::part(dialog)
: The modal.
open-stories::part(loading-visual)
: The loading overlay.open-stories::part(metadata)
: The
for metadata.open-stories::part(metadata-summary)
: The
for expanding metadata.open-stories::part(metadata-content)
: The metadata content container.
Whatever you put inside
will replace the default button text "View Stories". (MDN)
Attributes
src
: Required. A OpenStoriesFeed URL.duration
: Optional. Number in seconds. Default to5
.show-metadata
: Optional. Displayitems[]._open_stories.caption
.is-highlight
: Optional. View history does not get set.
Classes
.is-empty
: Present when no stories found..is-read
: Present when stories have all been viewed. This relies onlocalStroage
and does not work cross-origin/cross-devices..is-paused
: Present autoplay is paused.