-
Notifications
You must be signed in to change notification settings - Fork 0
/
wall.html
59 lines (49 loc) · 1.63 KB
/
wall.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Urturn demo</title>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'></script>
<style class="text/css">
.item {
float: left;
display: block;
width: 200px;
height: 200px;
background-size: cover;
background-position: center center;
}
</style>
</head>
<body>
<h1>Urturn thumbnails wall demo</h1>
<p>This is a demo to display thumbnails on a external site</p>
<div id="content_small"></div>
<div id="content_default"></div>
<script type="text/javascript">
var query = "britneyjean",
host = 'www.urturn.com',
ajaxUrl = 'http://' + host +'/api/search/thumbnails.json?q='+ query +'&page=1&per_page=200',
smallContentNode = jQuery('#content_small');
// here the query is #unionj
var jqxhr = jQuery.ajax(ajaxUrl)
.done(function(data) {
thumbnails = data.thumbnails;
var length = thumbnails.length,
img,
smallNewNodes = [];
for (var i=0; i<length; i++){
img = jQuery('<div/>', { 'class': 'item' })
.css({ 'background-image': 'url('+thumbnails[i].small+')' })
.data('url', thumbnails[i].post_url);
smallNewNodes.push(img);
}
smallContentNode.append(smallNewNodes);
jQuery('.item').on('click', function (e) {
var url = jQuery(e.target).data('url');
window.open(url);
});
});
</script>
</body>
</html>