Created
April 3, 2012 15:38
-
-
Save Natim/2292988 to your computer and use it in GitHub Desktop.
Vimeo Javascript Display Thumb
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
<html> | |
<head> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script type="text/javascript"> | |
function vimeoLoadingThumb(id){ | |
var url = "http://vimeo.com/api/v2/video/" + id + ".json?callback=showThumb"; | |
var id_img = "#vimeo-" + id; | |
var script = document.createElement( 'script' ); | |
script.type = 'text/javascript'; | |
script.src = url; | |
$(id_img).before(script); | |
} | |
function showThumb(data){ | |
var id_img = "#vimeo-" + data[0].id; | |
$(id_img).attr('src',data[0].thumbnail_medium); | |
} | |
</script> | |
</head> | |
<body> | |
<img id="vimeo-6271487" src="" alt="This is the example" /> | |
<script type="text/javascript"> | |
vimeoLoadingThumb(6271487); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works well, thanks!