Skip to content

Commit

Permalink
Center video list with javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysalvat committed Dec 13, 2012
1 parent dd687e8 commit 473f22e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
20 changes: 8 additions & 12 deletions public/javascripts/hvidio.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
var loader, socket,
$main = $('#main'),
$form = $('#form'),
$list = $('#video-list'),
$keyword = $('#keyword'),
$results = $('#results'),
$hashtags = $('#hashtags'),
$player = $('#player'),
$close = $('#close'),
$up = $('#up'),
$down = $('#down'),
$header = $('#header'),
$clickjack = $('#clickjack');

Expand Down Expand Up @@ -41,14 +37,6 @@
Search.com_init(socket);
});

// hashtags
$hashtags.on('click', 'a', function(e) {
$keyword.val($keyword.val());
$form.submit();

e.preventDefault();
});

// toggle main window
$clickjack.on('click', function(e) {
hvidio.show();
Expand Down Expand Up @@ -325,10 +313,18 @@
},

resize: function() {
// Adjusts result div height
var mh = $main.height(),
hh = $header.outerHeight();

$results.outerHeight(mh - hh - 20);

// Adjusts/centers result list
var mw = $main.width(),
ew = $results.find('li').outerWidth(true),
rw = (Math.floor(mw / ew)) * ew;

$results.find('.video-list').width(rw);
}
}

Expand Down
12 changes: 6 additions & 6 deletions public/stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ body {
color: white;
font: 100% "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
overflow: hidden;
}
a:link,
a:visited,
Expand Down Expand Up @@ -138,14 +139,13 @@ p.tagline {
margin-top: 20px;
overflow: scroll;
}
#results #video-list {
margin: 20px 1%;
width: 98%;
#results .video-list {
overflow: hidden;
margin: 0 auto;
}
#results .video {
visibility: hidden;
display: inline-block;
margin: 10px 1%;
float: left;
margin: 10px 10px;
min-height: 200px;
width: 230px;
position: relative;
Expand Down
14 changes: 8 additions & 6 deletions public/stylesheets/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ body {
color: white;
font: 100% "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
overflow: hidden;
}

a:link, a:visited, a:hover, a:active {
Expand Down Expand Up @@ -162,15 +163,16 @@ p.tagline {
margin-top: 20px;
overflow: scroll;

#video-list {
margin: 20px 1%;
width: 98%;
.video-list {
overflow: hidden;
margin: 0 auto;
}

.video {
visibility: hidden;
display: inline-block;
margin: 10px 1%;
// visibility: hidden;
// display: inline-block;
float: left;
margin: 10px 10px;
min-height: @cell-height;
width: 230px;
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ block content
div#close

script#videosTemplate(type='text/template')
| <ul id="video-list-<%= search %>">
| <ul id="video-list-<%= search %>" class="video-list">
| <% _.each(videos, function(video) { %>
| <% include videoTemplate %>
| <% }) %>
Expand Down

0 comments on commit 473f22e

Please sign in to comment.