jQuery Lazy Script Demo
jQuery plugin for lazy loading scripts to reduce the page loading time. lazy types are: scroll,visible,delay,click,hover
Demos:
Scroll Demo
Click Demo
Hover Demo
Visible Demo
Delay Demo
Example:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.lazyscript.js" type="text/javascript"></script>
</head>
<body>
<script>
$(document).ready(function () {
var options = {
type: "delay",
time:1000, //1 sec
scripts: [
"http://platform.twitter.com/widgets.js",
"http://connect.facebook.net/en_US/all.js#xfbml=1&appId=445577382175430",
"https://apis.google.com/js/plusone.js"
],
success: function () {
$.growl.notice({ message: "LAZY Scripts are Loaded",duration:20000 });
FB.init({ status: true, cookie: true, xfbml: true });
}
};
$.lazyscript(options);
});
</script>
</body>
</html>