Skip to content

Commit

Permalink
Merge pull request #849 from aFarkas/feature/bgset/fullsrc-bgsetproxy
Browse files Browse the repository at this point in the history
BGSet: Add `fullSrc` prop to the `bgsetproxy` event (fixes #827)
  • Loading branch information
aFarkas authored Dec 16, 2020
2 parents 42b8854 + c6a8a4b commit c4a3690
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions plugins/bgset/ls.bgset.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@


if(bg){
var useSrc = regBgUrlEscape.test(bg) ? JSON.stringify(bg) : bg;
var event = lazySizes.fire(elem, 'bgsetproxy', {
src: bg,
useSrc: regBgUrlEscape.test(bg) ? JSON.stringify(bg) : bg,
useSrc: useSrc,
fullSrc: null,
});

if(!event.defaultPrevented){
elem.style.backgroundImage = 'url(' + event.detail.useSrc + ')';
elem.style.backgroundImage = event.detail.fullSrc || 'url(' + event.detail.useSrc + ')';
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/bgset/ls.bgset.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c4a3690

Please sign in to comment.