Skip to content

1.1.3

Compare
Choose a tag to compare
@optimalisatie optimalisatie released this 12 Feb 16:28
· 50 commits to master since this release
  • Added: event handler based fallback (click, mouseover etc.)

Optional config:

{"events": ["click"]}

Also available as compressed array index 4.

The event handler based fallback enables to trigger the observer callback using an event handler when the observer fails.

This feature enables to show a user friendly placeholder using CSS and SVG.

img[data-src] {
    background-image: url(placeholder.svg);
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-color: #f9f9f9;
    cursor: context-menu;
}

img[data-src]:hover {
    background-color:#efefef;
}

Result:

Screenshot from 2020-02-12 17:26:22