Skip to content

Commit

Permalink
fix mobile to non-mobile client section javascript bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NikSteel committed Jul 28, 2015
1 parent 18888bd commit ab975ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
12 changes: 2 additions & 10 deletions _includes/clients.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ <h3 id="clients">Clients</h3>

<div class="clients-mobile-nav">
{% for client in site.data.settings.clients %}
{% if forloop.first %}
<span class="active-client"></span>
{% else %}
<span></span>
{% endif %}
<span class="client-button {% if forloop.first %}active-client{% endif %}"></span>
{% endfor %}
</div>

Expand Down Expand Up @@ -40,11 +36,7 @@ <h3 id="clients">Clients</h3>

<div class="clients-logos">
{% for client in site.data.settings.clients %}
{% if forloop.first %}
<img class="client-logo active-client" src="assets/img/clients/{{ client.logo }}" align="{{ client.logo }}">
{% else %}
<img class="client-logo" src="assets/img/clients/{{ client.logo }}" align="{{ client.logo }}">
{% endif %}
<img class="client-logo {% if forloop.first %}active-client{% endif %}" src="assets/img/clients/{{ client.logo }}" align="{{ client.logo }}">
{% endfor %}
</div>

Expand Down
11 changes: 6 additions & 5 deletions assets/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ function workLoad() {

function clientStuff() {

$('.client-logo, .clients-mobile-nav span').click(function() {
$('.client-logo, .client-button').click(function() {
var $this = $(this),
$siblings = $this.parent().children(),
position = $siblings.index($this);
position = $this.parent().children().index($this);

$('.client-unit').removeClass('active-client').eq(position).addClass('active-client');
$siblings.removeClass('active-client');
$this.addClass('active-client');
$('.client-logo').removeClass('active-client').eq(position).addClass('active-client');
$('.client-button').removeClass('active-client').eq(position).addClass('active-client');
});


Expand All @@ -91,13 +90,15 @@ function clientStuff() {
} else {
$('.client-unit').removeClass('active-client').first().addClass('active-client');
$('.client-logo').removeClass('active-client').first().addClass('active-client');
$('.client-button').removeClass('active-client').first().addClass('active-client');
}

} else {

if (position === 0) {
$('.client-unit').removeClass('active-client').last().addClass('active-client');
$('.client-logo').removeClass('active-client').last().addClass('active-client');
$('.client-button').removeClass('active-client').last().addClass('active-client');
} else {
$('.active-client').removeClass('active-client').prev().addClass('active-client');
}
Expand Down

0 comments on commit ab975ab

Please sign in to comment.