Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  3] [ 2]  / answers: 1 / hits: 26909  / 13 Years ago, tue, august 23, 2011, 12:00:00

I am looking for something similar to jQuery image lazy load plugin, but for iframes.


More From » jquery

 Answers
6

This worked for me.



var iframes = $('iframe');

$('button').click(function() {
iframes.attr('src', function() {
return $(this).data('src');
});
});

iframes.attr('data-src', function() {
var src = $(this).attr('src');
$(this).removeAttr('src');
return src;
});


jsFiddle.


[#90483] Saturday, August 20, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ross

Total Points: 477
Total Questions: 97
Total Answers: 98

Location: France
Member since Thu, May 6, 2021
3 Years ago
;