parent
6100eabb3c
commit
1f2461ef5a
@ -0,0 +1,31 @@ |
||||
let slideIdx = 0; |
||||
showSlides(slideIdx); |
||||
|
||||
function nextSlide(offset) { |
||||
showSlides(slideIdx += offset) |
||||
} |
||||
|
||||
function currentSlide(i) { |
||||
showSlides(slideIdx = i); |
||||
} |
||||
|
||||
function showSlides(i) { |
||||
let ii; |
||||
let slides = document.getElementsByClassName("slide-container"); |
||||
let dots = document.getElementsByClassName("dot"); |
||||
|
||||
console.log(slides); |
||||
|
||||
if( i > slides.length - 1 ) { slideIdx = 0; } |
||||
if( i < 0 ) {slideIdx = slides.length - 1} |
||||
|
||||
for( ii = 0; ii < slides.length; ii++ ) { |
||||
slides[ii].style.display = "none"; |
||||
} |
||||
for( ii = 0; ii < dots.length; ii++ ) { |
||||
dots[ii].className = dots[ii].className.replace(" active", ""); |
||||
} |
||||
|
||||
slides[slideIdx].style.display = "block";
|
||||
dots[slideIdx].className += " active"; |
||||
} |
@ -1,9 +1,25 @@ |
||||
h1 = auction.title |
||||
h2 = auction.description |
||||
#auction-view |
||||
- if auction.images.length >= 1 |
||||
.slideshow-container |
||||
- auction.images.each do |image| |
||||
.slide-container |
||||
.numbertext |
||||
a.prev onclick="nextSlide(-1)" = "<" |
||||
| #{image.image_order+1}/#{auction.images.length} |
||||
a.next onclick="nextSlide(1)" = ">" |
||||
img src="#{image.url}" |
||||
|
||||
ul.list-container |
||||
- auction.categories.each do |category| |
||||
p = category.name |
||||
|
||||
- auction.images.each do |img| |
||||
img src="#{img.url}" |
||||
.slideshow-button-container |
||||
- auction.images.each do |image| |
||||
span.dot onclick="setSlide(#{image.image_order})" |
||||
|
||||
#auctioninfo.card |
||||
h2 = auction.title |
||||
|
||||
ul.list-container#category-list |
||||
- auction.categories.each do |category| |
||||
p = category.name |
||||
|
||||
|
||||
script src="/js/slides.js" type="text/javascript" |
||||
|
Loading…
Reference in new issue