jQuery Plugin To Load iFrame Content Asynchronously EasyFrame - Download jQuery Plugin To Load iFrame Content Asynchronously - EasyFrame

Download jQuery Plugin To Load iFrame Content Asynchronously – EasyFrame

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin To Load iFrame Content Asynchronously – EasyFrame, hope it will help you in programming stack.

jQuery Plugin To Load iFrame Content Asynchronously EasyFrame - Download jQuery Plugin To Load iFrame Content Asynchronously - EasyFrame
File Size: 10.6 KB
Views Total: 3759
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

EasyFrame is a jQuery based iFrame enhancement plugin which loads iframe content (Youtube Videos, URLs, Widgets, etc) asynchronously on window load to improve page performance.

How to use it:

1. Include references to jQuery library and the jQuery EasyFrame plugin before the closing body tag.

1 <script src="//code.jquery.com/jquery-2.2.1.min.js"></script>
2 <script src="dist/jquery-easyframe.min.js"></script>

2. Initialize the plugin on document ready and we’re ready to go.

1 $('iframe').easyframe();

3. Create an iframe element and specify the address of the document to embed in this iframe using data-src attribute instead of src

1 <iframe src="" data-src="http://jqueryscript.net" frameborder="0"></iframe>

4. You can also specify the document’s address in the JavaScript during initialization.

1 $('iframe').easyframe({
3 });

5. Specify the timeout which is used to wait after the window loads to instantiate the iframe async loading.

1 $('iframe').easyframe({
2   timeout: 2000
3 });

6. All default options and callback.

1 $('iframe').easyframe({
2   url: null,
3   attribute: 'data-src',
4   timeout: 0
5 },function() {
6   // do something
7 });

Change log:

2016-03-14

  • Changed callback function at all iframe loaded

This awesome jQuery plugin is developed by EmanueleCoppola. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net