Showing
2 changed files
with
52 additions
and
46 deletions
1 | <% include ./includes/header.ejs %> | 1 | <% include ./includes/header.ejs %> |
2 | <div id="masonry_container"> | 2 | <div id="masonry_container"> |
3 | - 한식 | 3 | + <% var count = 0; %> |
4 | - <% for (var i in videos) { %> | 4 | + <% for (var i in video) { %> |
5 | - <div id="<%=videos[i].id%>" vid="<%=videos[i].video_id%>"> | 5 | + <div> |
6 | + <%=video[i].category.title%> | ||
6 | </div> | 7 | </div> |
7 | - <%};%> | 8 | + <% for (var j in video[i].videos) { %> |
9 | + <div id="<%=count%>" vid="<%=video[i].videos[j].video_id%>"> | ||
10 | + </div> | ||
11 | + <%count++;};};%> | ||
8 | </div> | 12 | </div> |
9 | - | ||
10 | -<style type="text/css"> | ||
11 | -.masonry-grid img { max-width: 260px; } | ||
12 | -</style> | ||
13 | -<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> | ||
14 | -<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.1/imagesloaded.pkgd.min.js"></script> | ||
15 | -<script type="text/javascript"> | ||
16 | - var $masonry_container = $('#masonry_container'); | ||
17 | - $masonry_container.imagesLoaded(function(){ | ||
18 | - $masonry_container.masonry({ | ||
19 | - itemSelector : '.masonry-grid', | ||
20 | - columnWidth : 270 | ||
21 | - }); | ||
22 | - }); | ||
23 | -</script> | ||
24 | -<script> | ||
25 | - var tag = document.createElement('script'); | ||
26 | 13 | ||
27 | - tag.src = "https://www.youtube.com/iframe_api"; | 14 | + <style type="text/css"> |
28 | - var firstScriptTag = document.getElementsByTagName('script')[0]; | 15 | + .masonry-grid img { |
29 | - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | 16 | + max-width: 260px; |
17 | + } | ||
18 | + </style> | ||
19 | + <script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> | ||
20 | + <script type="text/javascript" | ||
21 | + src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.1/imagesloaded.pkgd.min.js"></script> | ||
22 | + <script type="text/javascript"> | ||
23 | + var $masonry_container = $('#masonry_container'); | ||
24 | + $masonry_container.imagesLoaded(function () { | ||
25 | + $masonry_container.masonry({ | ||
26 | + itemSelector: '.masonry-grid', | ||
27 | + columnWidth: 270 | ||
28 | + }); | ||
29 | + }); | ||
30 | + </script> | ||
31 | + <script> | ||
32 | + var tag = document.createElement('script'); | ||
30 | 33 | ||
31 | - var player; | 34 | + tag.src = "https://www.youtube.com/iframe_api"; |
32 | - var players = []; | 35 | + var firstScriptTag = document.getElementsByTagName('script')[0]; |
33 | - var videoIds = []; | 36 | + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
34 | - for (var i = 0;i<10;i++) { | 37 | + var player; |
35 | - players.push(String(i)); | 38 | + var players = []; |
36 | - videoIds.push($('#'+i).attr('vid')); | 39 | + var videoIds = []; |
37 | - } | 40 | + for (var i = 0; i < 30; i++) { |
41 | + players.push(String(i)); | ||
42 | + videoIds.push($('#' + players[i]).attr('vid')); | ||
43 | + } | ||
38 | 44 | ||
39 | - function onYouTubeIframeAPIReady() { | 45 | + function onYouTubeIframeAPIReady() { |
40 | - for (var i = 0; i < videoIds.length; i++) { | 46 | + for (var i = 0; i < videoIds.length; i++) { |
41 | - player = new YT.Player(players[i], { | 47 | + player = new YT.Player(players[i], { |
42 | - height: '360', | 48 | + height: '360', |
43 | - width: '640', | 49 | + width: '640', |
44 | - videoId: videoIds[i], | 50 | + videoId: videoIds[i], |
45 | - events: { | 51 | + events: { |
46 | - // 'onReady': onPlayerReady, | 52 | + // 'onReady': onPlayerReady, |
47 | - // 'onStateChange': onPlayerStateChange | 53 | + // 'onStateChange': onPlayerStateChange |
48 | - } | 54 | + } |
49 | - }); | 55 | + }); |
56 | + } | ||
50 | } | 57 | } |
51 | - } | ||
52 | 58 | ||
53 | // function onPlayerReady(event) { | 59 | // function onPlayerReady(event) { |
54 | // } | 60 | // } |
... | @@ -56,5 +62,5 @@ | ... | @@ -56,5 +62,5 @@ |
56 | // } | 62 | // } |
57 | // function stopVideo() { | 63 | // function stopVideo() { |
58 | // } | 64 | // } |
59 | -</script> | ||
60 | -<% include ./includes/footer.ejs %> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
65 | + </script> | ||
66 | + <% include ./includes/footer.ejs %> | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
30 | </div> | 30 | </div> |
31 | <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9"> | 31 | <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9"> |
32 | <ul class="nav navbar-nav"> | 32 | <ul class="nav navbar-nav"> |
33 | - <li class="active"> | 33 | + <li> |
34 | <a href="/">Home</a> | 34 | <a href="/">Home</a> |
35 | </li> | 35 | </li> |
36 | <li><a href="/categori/products">Categori</a></li> | 36 | <li><a href="/categori/products">Categori</a></li> | ... | ... |
-
Please register or login to post a comment