<style>
.desgin_iframe_dimn {
background: white;
height: 500px;
width: 500px;
}
</style>
<iframe scrolling="no" id="lazy" class="desgin_iframe_dimn" data-src="http://www.google.com"></iframe>
<p class="lazy">Click Here</p>
<script>
function LazyLoadIframe() {
$('.lazy').click(function() {
$('#lazy').attr('src', function() {
return $(this).data('src');
});
});
$('#lazy').attr('data-src', function() {
var src = $(this).attr('src');
$(this).removeAttr('src');
return src;
});
}
LazyLoadIframe();
</script>
デモはこちら
上記のコードは、IE9 および IE8 の他のブラウザーでも正常に動作しますが、IE7 では正常に動作しません。どうすればこれを修正できますか?