
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
jquery-lazyload-any
Advanced tools
A jQuery plugin provides a lazyload function for images, iframe or anything.
A jQuery plugin provides a lazyload function for images, iframe or anything.
Images (Overflow and Tabs)
Youtube
You can install jquery-lazyload-any by using Bower.
bower install jquery-lazyload-any
For node.js, you can use this command to install:
npm install jquery-lazyload-any
HTML
Attribute Style
<div id="you-want-lazyload" data-lazyload="<p>Anything you want to lazyload</p>">
</div>
Script Style
<div id="you-want-lazyload">
<script type="text/lazyload">
<p>Anything you want to lazyload</p>
</script>
</div>
Comment Style
<div id="you-want-lazyload">
<!--
<p>Anything you want to lazyload</p>
-->
</div>
JavaScript
$('#you-want-lazyload').lazyload(options);
You should choose only one style. When multiple styles set, priority is Attribute > Script > Comment.
Number
(default: 0
)Sets the pixels to load earlier. Setting threshold to 200 causes image to load 200 pixels before it appears on viewport. It should be greater or equal zero.
Function(element)
(default: undefined
)Sets the callback function when the load event is firing.
element
: The content in lazyload tag will be returned as a jQuery object.
String
(default: "appear"
)Sets events to trigger lazyload. Default is customized event appear
, it will trigger when element appear in screen. You could set other events including each one separated by a space, ex: mousedown touchstart
.
Force to trigger detection event.
Set interval of timer that check container display status.
Number
(default: 50
)Interval of timer. Set 0 to disable timer, and you can use $.lazyload.check()
to trigger detection manually.
Refresh status of elements bound event. Element will bind scroll event to parent scrollable automatically when initializing as lazyload. If you move element, you should use this method to bind again.
String
or Object
(default: undefined
)The elements that you want to refresh. It will refresh all lazyload elements if you don't pass this parameter.
$.lazyload.check()
to force detection.element.is(':visible')
, it will return false if element's width and height are equal to zero. So you have to make sure the lazyload element with any width or height.HTML
<div class="lazyload">
<!--
<img src="image.png" />
-->
</div>
JavaScript
$('.lazyload').lazyload({
// Sets the pixels to load earlier. Setting threshold to 200 causes image to load 200 pixels
// before it appears on viewport. It should be greater or equal zero.
threshold: 200,
// Sets the callback function when the load event is firing.
// element: The content in lazyload tag will be returned as a jQuery object.
load: function(element) {},
// Sets events to trigger lazyload. Default is customized event `appear`, it will trigger when
// element appear in screen. You could set other events including each one separated by a space.
trigger: "appear"
});
The project is released under the MIT license.
The project's website is located at https://github.com/emn178/jquery-lazyload-any
Author: Yi-Cyuan Chen (emn178@gmail.com)
v0.3.1 / 2017-11-25
FAQs
A jQuery plugin provides a lazyload function for images, iframe or anything.
The npm package jquery-lazyload-any receives a total of 67 weekly downloads. As such, jquery-lazyload-any popularity was classified as not popular.
We found that jquery-lazyload-any demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.