generated from mate-academy/gulp-template
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4345d1
commit e01181f
Showing
8 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,44 @@ | ||
'use strict'; | ||
|
||
const form = document.getElementById('form'); | ||
form.addEventListener('submit',function(event){ | ||
event.preventDefault(); | ||
|
||
window.scrollTo({ | ||
top:0, | ||
behavior:'smooth' | ||
}) | ||
}) | ||
|
||
|
||
|
||
document.addEventListener('DOMContentLoaded', function () { | ||
const slider = document.getElementById('slider'); | ||
const images = slider.getElementsByClassName('hero__slider_photos-item'); | ||
const prevButton = document.getElementById('prev'); | ||
const nextButton = document.getElementById('next'); | ||
let currentIndex = 0; | ||
|
||
function updateSlider() { | ||
for (let i = 0; i < images.length; i++) { | ||
images[i].classList.remove('active'); | ||
} | ||
images[currentIndex].classList.add('active'); | ||
} | ||
|
||
function showPrev() { | ||
currentIndex = (currentIndex > 0) ? currentIndex - 1 : images.length - 1; | ||
updateSlider(); | ||
} | ||
|
||
function showNext() { | ||
currentIndex = (currentIndex < images.length - 1) ? currentIndex + 1 : 0; | ||
updateSlider(); | ||
} | ||
|
||
prevButton.addEventListener('click', showPrev); | ||
nextButton.addEventListener('click', showNext); | ||
|
||
updateSlider(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters