Lazy load iframe
This commit is contained in:
parent
f6b16a30ac
commit
7150718a51
2 changed files with 9 additions and 1 deletions
|
@ -85,5 +85,10 @@ def markdown(value, lazy_load=False):
|
|||
if img.get("src"):
|
||||
img["data-src"] = img["src"]
|
||||
img["src"] = ""
|
||||
for img in soup.findAll("iframe"):
|
||||
if img.get("src"):
|
||||
img["data-src"] = img["src"]
|
||||
img["src"] = ""
|
||||
html = str(soup)
|
||||
|
||||
return '<div class="md-typeset">%s</div>' % html
|
||||
|
|
|
@ -179,7 +179,10 @@ $(function () {
|
|||
$("[data-src]img").each(function() {
|
||||
$(this).attr("src", $(this).attr("data-src"));
|
||||
})
|
||||
}, "500");
|
||||
$("[data-src]iframe").each(function() {
|
||||
$(this).attr("src", $(this).attr("data-src"));
|
||||
})
|
||||
}, "100");
|
||||
});
|
||||
|
||||
if (!Date.now) {
|
||||
|
|
Loading…
Reference in a new issue