Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.
/ BgImgLoader Public archive

A small plugin for loading CSS background images with callback

Notifications You must be signed in to change notification settings

towardstudio/BgImgLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BgImgLoader

A small plugin for loading CSS background images with callback. This allows you to load the image in programmatically and then respond to it OnLoad event via a callback. The plugin will load the image from the URI of a data attribute on the element (default is "data-bg-src")

Options

srcAttr: The data attribute containing the URL of the image to load. (default: "data-bg-src)

callback: Function to call when the image has loaded and been applied to the 'background-image' CSS attribute of the element.

Usage

$(".element").bgImgLoad({
  srcAttr: "data-img-url",
  callback: function(){
    $(this).addClass("loaded");
  }
});

About

A small plugin for loading CSS background images with callback

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published