Skip to content

Commit ddebbc8

Browse files
committed
minor adjustments to render
1 parent 818a54a commit ddebbc8

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

js/render_books.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
var cache = {}; //cache is available everywhere
2-
var render = function(book, bin) {
3-
var id = book.id;
4-
cache[id] = book;
2+
var render = function(book, container) {
3+
// var id = book.id;
4+
// cache[id] = book;
55
var html =
6-
'<div class="col-xs-12 col-sm-6 col-md-3 tile clearfix" >' +
6+
'<div class="col-xs-12 col-sm-6 col-md-3 tile clearfix">' +
77
'<a href="#" class="thumbnail">' +
88
'<img src="'+book.volumeInfo.imageLinks.smallThumbnail+'" alt="..." style="height: 130px; width: auto; overflow: hidden;">' +
99
'<p class="text-center title" style="font-size:10px; white-space: nowrap; overflow:hidden;"><strong>' +book.volumeInfo.title + '</strong></p>' +
1010
'<p class="text-center authors"style="font-size:10px; white-space: nowrap; overflow:hidden;">' + book.volumeInfo.authors[0] + '</p>' +
1111
'</a>' +
1212
'</div>';
1313

14-
$(html).data("id", id).appendTo(bin);
14+
$(html)
15+
.data("book", book)
16+
.appendTo(container);
1517

1618
}
1719
var renderAll = function(books, container) { //calling a method

0 commit comments

Comments
 (0)