Created
March 15, 2015 19:36
-
-
Save JuanjoSalvador/7b7a2e5cf4e33c235918 to your computer and use it in GitHub Desktop.
Script JS para insertar Tumblr en tu website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="http://your-tumblr-blog/js?num=5"></script> | |
<script type="text/javascript"> | |
//try to remove img and iframe src asap to avoid image loading | |
$('.tumblr_posts .tumblr_photo_post img, .tumblr_posts .html_photoset iframe').each(function(index, element) | |
{ | |
$(element).attr('data-src', $(element).attr('src')) | |
$(element).removeAttr('src').addClass('superload') | |
}) | |
//load src when the page is loaded | |
$(window).load(function(e) | |
{ | |
$('.tumblr_posts .tumblr_photo_post img, .tumblr_posts .html_photoset iframe').each(function(index, element) | |
{ | |
$(element).attr('src', $(element).attr('data-src')) | |
$(element).removeAttr('data-src').removeClass('superload') | |
}) | |
}) </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment