Skip to content

Commit cccfc7d

Browse files
committed
Gallery interface and styling per #64
1 parent df5c57f commit cccfc7d

File tree

4 files changed

+34
-33
lines changed

4 files changed

+34
-33
lines changed

_layouts/default.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
<title>{{ site.name }} | {{ page.title }}</title>
77
<meta name="description" content="">
88

9-
<meta name="viewport" content="width=1024,
10-
user-scalable=yes, target-densitydpi=device-dpi">
9+
<meta name="viewport" content="width=1024, user-scalable=yes">
1110

1211
<link rel="stylesheet" href="/css/bootstrap.min.css">
1312
<link rel="stylesheet" href="/css/spectrum.css">

css/main.scss

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,15 @@ div#displayEditor {
646646
box-shadow: 4px 4px 1px rgba(0,0,0,.25);
647647
}
648648

649+
#loadMore {
650+
background: $light-color;
651+
}
652+
653+
#loadMore:hover {
654+
background: $mid-color;
655+
text-decoration: none;
656+
}
657+
649658
#galleryFilter {
650659
background: $secondary-color;
651660
height: 32px;
@@ -675,12 +684,6 @@ div#displayEditor {
675684
border-bottom: 2px solid white;
676685
}
677686

678-
#galleryControls {
679-
width: 100%;
680-
text-align: center;
681-
padding-bottom: 12px;
682-
}
683-
684687
/* Hints Preview */
685688

686689
.hintPreview {

gallery/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script id="template" type="text/html">
88
{% raw %}
9-
<div class="galleryImage">
9+
<div class="galleryImage" data-index="0">
1010
<a href="{{link}}"><img src="{{image}}" width="250" height="200"/></a>
1111
</div>
1212
{% endraw %}
@@ -34,12 +34,12 @@
3434
</a>
3535
</div>
3636

37-
<div id="galleryView"></div>
37+
<div id="galleryView">
38+
39+
<button id="loadMore" class="galleryImage btn btn-link" data-loading-text="Loading..." data-index="1">
40+
<span class="glyphicon glyphicon-plus"></span> Load More
41+
</button>
3842

39-
<div id="galleryControls">
40-
<button id="loadMore" class="btn btn-default btn-sm" data-loading-text="Loading...">
41-
<span class="glyphicon glyphicon-plus"></span> Load More
42-
</button>
4343
</div>
4444

4545
</div>

js/gallery.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var helloGallery = {
2525

2626
helloGallery.pageNumber = 0;
2727
$('#galleryView').isotope('destroy');
28-
$('#galleryView').html("");
28+
$('.galleryImage').not("#loadMore").remove();
2929
$("#loadMore").show();
3030

3131
helloGallery.loadInitial();
@@ -50,30 +50,29 @@ var helloGallery = {
5050

5151
loadInitial: function() {
5252

53-
helloGallery.loadElements( function(elements){
54-
55-
var container = $('#galleryView');
56-
container.append( elements );
53+
$('#galleryView').isotope({
54+
itemSelector: '.galleryImage',
55+
sortBy : 'index',
56+
getSortData: {
57+
index: '[data-index]'
58+
},
59+
masonry: {
60+
gutter: 12,
61+
isFitWidth: true
62+
}
63+
});
5764

58-
container.isotope({
59-
itemSelector: '.galleryImage',
60-
masonry: {
61-
gutter: 12,
62-
isFitWidth: true
63-
}
64-
});
65-
});
65+
helloGallery.loadMore();
6666
},
6767

6868
loadMore: function() {
6969

7070
helloGallery.loadElements(function(elements){
71-
7271
for (var element in elements) {
7372
var item = $(elements[element]);
7473

75-
$('#galleryView').append(item);
76-
$('#galleryView').isotope('appended', item);
74+
//$('#galleryView').append(item);
75+
$('#galleryView').isotope('insert', item);
7776
}
7877
});
7978

@@ -90,17 +89,17 @@ var helloGallery = {
9089

9190
switch (helloGallery.sortMode) {
9291
case 0:
93-
console.log("Featured");
92+
//console.log("Featured");
9493
query.descending("featureScore");
9594
query.addDescending("createdAt");
9695
break;
9796
case 1:
98-
console.log("Popular");
97+
//console.log("Popular");
9998
query.descending("viewCount");
10099
query.addDescending("createdAt");
101100
break;
102101
case 2:
103-
console.log("Recent");
102+
//console.log("Recent");
104103
query.descending("createdAt");
105104
break;
106105
}

0 commit comments

Comments
 (0)