Skip to content

Commit

Permalink
1.7.2
Browse files Browse the repository at this point in the history
- fixed possible problems with jQuery 3's new async ready state
- added 'main' field to package.json
- changed '.error()' to '.trigger("error")'
- new 'picture' plugin
- new 'vimeo' plugin
- added cross domain / CORS hedaers to 'iframe' plugin
- corrected error response of 'youtube' plugin
  • Loading branch information
dkern committed Aug 2, 2016
1 parent ed4d037 commit aa5fc0a
Show file tree
Hide file tree
Showing 16 changed files with 467 additions and 25 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -57,12 +57,12 @@ Some examples below:
Lazy and all plugins are available over [cdnjs](http://cdnjs.com) and [jsDelivr](http://jsdelivr.com) CDN and can directly included to every page.
```HTML
<!-- jsDeliver -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazy/1.7.1/jquery.lazy.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazy/1.7.1/jquery.lazy.plugins.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazy/1.7.2/jquery.lazy.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazy/1.7.2/jquery.lazy.plugins.min.js"></script>

<!-- cdnjs -->
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.1/jquery.lazy.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.1/jquery.plugins.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.2/jquery.lazy.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.2/jquery.plugins.min.js"></script>
```

#### Self-Hosted
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "jquery-lazy",
"description": "Lazy is a fast, feature-rich and lightweight delayed content loading plugin for jQuery and Zepto. It's designed to speed up page loading times and decrease traffic to your users by only loading the content in view. You can use Lazy in all vertical and horizontal scroll ways. It supports images in 'img' tags and backgrounds, supplied with css like 'background-image', by default. On those elements Lazy can set an default image or a placeholder while loading and supports retina displays as well. But Lazy is even able to load any other content you want by plugins and custom loaders.",
"version": "1.7.1",
"version": "1.7.2",
"main": "jquery.lazy.min.js",
"license": [
"MIT",
Expand Down
20 changes: 15 additions & 5 deletions jquery.lazy.js
@@ -1,5 +1,5 @@
/*!
* jQuery & Zepto Lazy - v1.7.1
* jQuery & Zepto Lazy - v1.7.2
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2016, Daniel 'Eisbehr' Kern
Expand All @@ -25,7 +25,13 @@
* unique plugin instance id counter
* @type {number}
*/
lazyInstanceId = 0;
lazyInstanceId = 0,

/**
* helper to register window load for jQuery 3
* @type {boolean}
*/
windowLoaded = false;

/**
* make lazy available to jquery - and make it a bit more case-insensitive :)
Expand Down Expand Up @@ -409,7 +415,7 @@
element.off(_error);
errorCallback();
}
})) element.error();
})) element.trigger(_error);
}

// handle images
Expand Down Expand Up @@ -601,8 +607,8 @@
return false;
}

// if event driven don't wait for page loading
if( config.bind == "event" )
// if event driven or window is already loaded don't wait for page loading
if( config.bind == "event" || windowLoaded )
_initialize();

// otherwise load initial items and start lazy after page load
Expand Down Expand Up @@ -787,4 +793,8 @@
onError : undefined,
onFinishedAll : undefined
};

// register window load event globally to prevent not loading elements
// since jQuery 3.X ready state is fully async and may be executed after 'load'
$(window).on("load", function() { windowLoaded = true; });
})(window);
4 changes: 2 additions & 2 deletions jquery.lazy.min.js

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

0 comments on commit aa5fc0a

Please sign in to comment.