Skip to content

Commit

Permalink
Add carousel arrows (#4977)
Browse files Browse the repository at this point in the history
* Add carousel arrows

* Update featured-bounties.css

* fix stylelint
  • Loading branch information
octavioamu authored and thelostone-mc committed Aug 7, 2019
1 parent 9c3b47b commit d52a466
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/assets/v2/css/featured-bounties.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@
color: #fff;
background-color: #0d003c;
padding: 0.7rem 1.5rem;
position: relative;
}

.featured-bounties__arrow {
position: absolute;
top: 0;
bottom: 0;
opacity: 0;
z-index: 1;
color: #10ce7c;
background: transparent;
border: none;
}

.featured-bounties__arrow:hover,
.featured-bounties__arrow:focus {
color: #57e6a8;
opacity: 1;
}

.featured-bounties:hover .featured-bounties__arrow {
opacity: 1;
}

.featured-bounties__arrow-left {
left: 0;
}

.featured-bounties__arrow-right {
right: 10px;
}

.featured-bounties__title {
Expand Down
14 changes: 14 additions & 0 deletions app/assets/v2/js/pages/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ var paint_search_tabs = function() {
target.html(html);
};

function scrollSlider(element, cardSize) {
const arrowLeft = $('#arrowLeft');
const arrowRight = $('#arrowRight');

arrowLeft.on('click', function() {
element[0].scrollBy({left: -cardSize, behavior: 'smooth'});
});
arrowRight.on('click', function() {
element[0].scrollBy({left: cardSize, behavior: 'smooth'});
});

}
scrollSlider($('#featured-card-container'), 288);

function debounce(func, wait, immediate) {
var timeout;

Expand Down
2 changes: 2 additions & 0 deletions app/dashboard/templates/dashboard/featured_bounties.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ <h3 class="featured-bounties__title">
</span>
</h3>
</div>
<button class="featured-bounties__arrow featured-bounties__arrow-left" id="arrowLeft"><i class="fas fa-angle-left fa-2x"></i></button>
<button class="featured-bounties__arrow featured-bounties__arrow-right" id="arrowRight"><i class="fas fa-angle-right fa-2x"></i></button>
<div class="scroll-carousel" id="featured-card-container"></div>
</div>

0 comments on commit d52a466

Please sign in to comment.