Skip to content

Commit 374de01

Browse files
committed
Multiple featured & Responsive improvement
1 parent 1dc5501 commit 374de01

5 files changed

Lines changed: 279 additions & 251 deletions

File tree

‎index.html‎

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,29 @@
3333

3434
</div>
3535

36-
<!-- --------------------------------------------------------------------------------------
37-
Featured
38-
-------------------------------------------------------------------------------------- -->
36+
<!-- --------------------------------------------------------------------------------------
37+
Featured
38+
-------------------------------------------------------------------------------------- -->
3939

40-
<div class="header">
41-
<div class="wrapper" ng-repeat="featured in featureds" ng-class="{actual: $index <= indexFeatured}">
40+
<div class="header" id="featuredProj">
41+
<div class="wrapper" ng-repeat="featured in featureds['projects']" ng-class="{actual: $index <= indexFeatured['projects']}">
4242
<div class="row">
43-
<div class="large-4 columns text-header" ng-bind-html-unsafe="featured.textHeader"></div>
43+
<div class="large-5 columns text-header">
44+
<div class="small-11 small-offset-1 columns" ng-bind-html-unsafe="featured.textHeader"></div>
45+
</div>
4446

45-
<div class="large-5 large-offset-1 columns">
47+
<div class="large-6 columns">
4648
<img class="logo logoFeatured original" src="{{featured.logo}}" title="{{featured.title}}" />
4749
</div>
4850
</div>
4951
</div>
5052

5153
<div class="dots">
52-
<div class="dot" ng-repeat="featured in featureds" ng-class="{actual: $index == indexFeatured}" ng-click="setIndexFeatured($index)"></div>
54+
<div class="dot" ng-repeat="featured in featureds['projects']" ng-class="{actual: $index == indexFeatured['projects']}" ng-click="setIndexFeatured('projects', $index)"></div>
5355
</div>
5456

55-
<div class="prev" ng-click="changeIndexFeatured(-1)"></div>
56-
<div class="next" ng-click="changeIndexFeatured(+1)"></div>
57+
<div class="prev" ng-click="changeIndexFeatured('projects', -1)"></div>
58+
<div class="next" ng-click="changeIndexFeatured('projects', +1)"></div>
5759
</div>
5860

5961
<div class="main top">
@@ -184,29 +186,40 @@ <h1>{{project.name}}</h1>
184186
<div ng-class="{ buttonMore: projLast > 10, buttonLess : projLast == 10 }" ng-hide="(projects | projectsFilter:this).length < 10">
185187
<div class="row text-center">
186188
<button class="button" ng-click="showHideProj()">
187-
<span ng-hide="projLast != 10">Show more...</span>
188-
<span ng-show="projLast > 10">Show less...</span>
189+
<span ng-hide="projLast != 10">Show more...</span>
190+
<span ng-show="projLast > 10">Show less...</span>
189191
</button>
190192
</div>
191193
</div>
192194

193195
<div ng-hide="loading == false">
194-
Loading...
195-
</div>
196+
Loading...
197+
</div>
196198
</div>
197199
</div>
198-
199-
<div class="header_inline" id="header_org">
200-
<div class="row" id="text-header_org">
201-
<img class="logo original" id="logo2" src="img/photoshop_logo.svg" title="Brackets, code the web" />
202200

203-
<div class="large-6 large-offset-6 columns">
204-
<h3>Photoshop</h3>
205-
<p class="details">Stuff from the Adobe Photoshop team<br/>
206-
<a href="">Learn more...</a>
207-
</p>
201+
<!-- --------------------------------------------------------------------------------------
202+
Featured Organisations
203+
-------------------------------------------------------------------------------------- -->
204+
205+
<div class="header_inline" id="featuredOrg">
206+
<div class="wrapper" ng-repeat="featured in featureds['org']" ng-class="{actual: $index <= indexFeatured['org']}">
207+
<div class="row">
208+
<div class="large-5 columns">
209+
<img class="logo logoFeatured original" src="{{featured.logo}}" title="{{featured.title}}" />
210+
</div>
211+
<div class="large-7 large-offset-5 columns text-header">
212+
<div class="small-11 small-offset-1 columns" ng-bind-html-unsafe="featured.textHeader"></div>
213+
</div>
208214
</div>
209215
</div>
216+
217+
<div class="dots">
218+
<div class="dot" ng-repeat="featured in featureds['org']" ng-class="{actual: $index == indexFeatured['org']}" ng-click="setIndexFeatured('org', $index)"></div>
219+
</div>
220+
221+
<div class="prev" ng-click="changeIndexFeatured('org', -1)"></div>
222+
<div class="next" ng-click="changeIndexFeatured('org', +1)"></div>
210223
</div>
211224

212225
<div class="main">

‎js/script.js‎

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ this.GitHubCtrl = function($scope, $filter, ReposAdobe, FeaturedHeader) {
191191
$scope.Object = Object;
192192
$scope.filter = $filter;
193193
$scope.filterStarIndex = 0;
194-
$scope.indexFeatured = 0;
194+
$scope.indexFeatured = {
195+
"org": 0,
196+
"projects": 0
197+
};
195198
$scope.searchLang = new Array();
196199
$scope.searchOrg = new Array();
197200

@@ -207,25 +210,31 @@ this.GitHubCtrl = function($scope, $filter, ReposAdobe, FeaturedHeader) {
207210

208211
// hFeatured on the header
209212
$scope.featureds = FeaturedHeader.query( function() {
210-
for (var i = 0; i < $scope.featureds.length; i++) {
211-
var actFeatured = $scope.featureds[i];
212-
213-
actFeatured.textHeader = actFeatured.textHeader.join("\n");
214-
};
213+
console.log("YEa");
214+
$scope.featureds = $scope.featureds[0];
215+
var keys = Object.keys($scope.featureds);
216+
for (var i = 0; i < keys.length; i++) {
217+
var actFeatured = $scope.featureds[keys[i]];
218+
for (var j = 0; j < actFeatured.length; j++) {
219+
var actFeaturedItem = actFeatured[j];
220+
221+
actFeaturedItem.textHeader = actFeaturedItem.textHeader.join("\n");
222+
};
223+
};
215224
});
216225

217-
$scope.changeIndexFeatured = function(delta) {
218-
if ($scope.indexFeatured <= 0 && delta < 0) {
219-
$scope.indexFeatured = $scope.featureds.length - 1;
220-
} else if ($scope.indexFeatured >= $scope.featureds.length-1 && delta > 0) {
221-
$scope.indexFeatured = 0;
226+
$scope.changeIndexFeatured = function(i, delta) {
227+
if ($scope.indexFeatured[i] <= 0 && delta < 0) {
228+
$scope.indexFeatured[i] = $scope.featureds[i].length - 1;
229+
} else if ($scope.indexFeatured[i] >= $scope.featureds[i].length-1 && delta > 0) {
230+
$scope.indexFeatured[i] = 0;
222231
} else {
223-
$scope.indexFeatured += delta;
232+
$scope.indexFeatured[i] += delta;
224233
}
225234
}
226235

227-
$scope.setIndexFeatured = function(index) {
228-
$scope.indexFeatured = index;
236+
$scope.setIndexFeatured = function(i, index) {
237+
$scope.indexFeatured[i] = index;
229238
}
230239

231240
//------------------------------- Datas --------------------------------
@@ -252,7 +261,7 @@ this.GitHubCtrl = function($scope, $filter, ReposAdobe, FeaturedHeader) {
252261
$scope.projLast = 100;
253262
}
254263
else {
255-
$("html, body").animate({ scrollTop: 350 }, 100);
264+
$("html, body").animate({ scrollTop: 380 }, 100);
256265
$scope.projLast = 10;
257266
}
258267
}
@@ -296,29 +305,21 @@ $(function(){
296305

297306
$(window).scroll(function () {
298307
scrollTop = $(window).scrollTop();
299-
300-
var endOfProjects = scrollTop + $(window).height() - $('.top').height() - $('.header').height();
301-
if (endOfProjects < 80 ) {
302-
$(".buttonMore").css({position: 'fixed', bottom: 0});
303-
}
304-
else {
305-
$(".buttonMore").css({position: 'absolute', bottom: -50});
306-
}
307308

308309
// ----------------------------------------------------------------------------
309310
// First parallax: header
310-
if (scrollTop < ($(".header").height() + 20) ) {
311+
if (scrollTop < ($("#featuredProj").height() + 20) ) {
311312
topLogo_header = ( $(window).scrollTop()/3 ) - 70;
312-
$(".logoFeatured").css({ top: topLogo_header });
313-
$(".text-header").css({ bottom: 45 + scrollTop });
313+
$("#featuredProj .logo").css({ top: topLogo_header });
314+
$("#featuredProj .text-header").css({ bottom: 0 + scrollTop });
314315
}
315316

316317
// ----------------------------------------------------------------------------
317318
// 2nd parrallax: organisations
318-
topLogo_org = ( ( $(window).scrollTop() - $("#header_org").position().top + 350 ) / 2 ) - 10 ;
319+
topLogo_org = ( ( $(window).scrollTop() - $("#featuredOrg").position().top + 350 ) / 2 ) - 10 ;
319320
if ( topLogo_org > 90 )
320321
topLogo_org = 90;
321-
$("#logo2").css({ top: topLogo_org });
322+
$("#featuredOrg .logo").css({ top: topLogo_org });
322323

323324
// ----------------------------------------------------------------------------
324325
// 3rd parrallax: footer

‎offline/featured.json‎

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,55 @@
11
[
2-
{
3-
"title": "Brackets, code the web",
4-
"logo": "img/brackets_logo.svg",
5-
"textHeader": [
6-
"<h3>Brackets</h3>",
7-
"<p class='details'>Open-source code editor<br> built <em>with</em> the web <em>for</em> the web<br/>",
8-
"<a href='http://brackets.io/'>Learn more...</a></p>"
9-
]
10-
},
11-
{
12-
"title": "PhoneGap, Easily create apps using the web technologies you know and love: HTML, CSS, and JavaScript",
13-
"logo": "img/phonegap.svg",
14-
"textHeader": [
15-
"<h3>PhoneGap</h3>",
16-
"<p class='details'>Free and open source framework to create apps using web technologies.<br/>",
17-
"PhoneGap is a distribution of <a href='http://cordova.apache.org/'>Apache Cordova</a><br/>",
18-
"<a href='https://github.com/phonegap/'>View on GitHub ></a></p>"
19-
]
20-
},
21-
{
22-
"title": "Snap.svg",
23-
"logo": "img/snapsvg.svg",
24-
"textHeader": [
25-
"<h3>Snap.svg</h3>",
26-
"<p class='details'>The JavaScript SVG library for the modern web.<br/>",
27-
"<a href='http://snapsvg.io/'>Learn more...</a></p>"
28-
]
29-
}
2+
{
3+
"projects": [
4+
{
5+
"title": "Brackets, code the web",
6+
"logo": "img/brackets_logo.svg",
7+
"textHeader": [
8+
"<h3>Brackets</h3>",
9+
"<p class='details'>Open-source code editor<br> built <em>with</em> the web <em>for</em> the web<br/>",
10+
"<a href='http://brackets.io/'>Learn more...</a></p>"
11+
]
12+
},
13+
{
14+
"title": "PhoneGap, Easily create apps using the web technologies you know and love: HTML, CSS, and JavaScript",
15+
"logo": "img/phonegap.svg",
16+
"textHeader": [
17+
"<h3>PhoneGap</h3>",
18+
"<p class='details'>Free and open source framework to create apps using web technologies.<br/>",
19+
"PhoneGap is a distribution of <a href='http://cordova.apache.org/'>Apache Cordova</a><br/>",
20+
"<a href='https://github.com/phonegap/'>View on GitHub ></a></p>"
21+
]
22+
},
23+
{
24+
"title": "Snap.svg",
25+
"logo": "img/snapsvg.svg",
26+
"textHeader": [
27+
"<h3>Snap.svg</h3>",
28+
"<p class='details'>The JavaScript SVG library for the modern web.<br/>",
29+
"<a href='http://snapsvg.io/'>Learn more...</a></p>"
30+
]
31+
}
32+
],
33+
"org": [
34+
{
35+
"title": "Photoshop",
36+
"logo": "img/photoshop_logo.svg",
37+
"textHeader": [
38+
"<h3>Photoshop</h3>",
39+
"<p class='details'>Stuff from the Adobe Photoshop team<br/>",
40+
"<a href=''>Learn more...</a>"
41+
]
42+
},
43+
{
44+
"title": "Photoshop",
45+
"logo": "img/photoshop_logo.svg",
46+
"textHeader": [
47+
"<h3>Photoshop 2</h3>",
48+
"<p class='details'>Free and open source framework to create apps using web technologies.<br/>",
49+
"PhoneGap is a distribution of <a href='http://cordova.apache.org/'>Apache Cordova</a><br/>",
50+
"<a href='https://github.com/phonegap/'>View on GitHub ></a></p>"
51+
]
52+
}
53+
]
54+
}
3055
]

0 commit comments

Comments
 (0)