-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
5 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,5 +1,36 @@ | ||
// Add imports above this line | ||
import { galleryItems } from './gallery-items'; | ||
import SimpleLightbox from 'simplelightbox'; | ||
import 'simplelightbox/dist/simple-lightbox.min.css'; | ||
// Change code below this line | ||
|
||
console.log(SimpleLightbox); | ||
|
||
console.log(galleryItems); | ||
|
||
const galleryContainer = document.querySelector('.gallery'); | ||
console.log(galleryContainer); | ||
|
||
function createGalleryItemsMarkup(arr) { | ||
return arr | ||
.map( | ||
({ preview, original, description }) => | ||
`<li class="gallery__item"> | ||
<a class="gallery__link" href="${original}"> | ||
<img class="gallery__image" src=${preview} alt="${description}" /> | ||
</a> | ||
</li>` | ||
) | ||
.join(''); | ||
} | ||
|
||
galleryContainer.insertAdjacentHTML( | ||
'beforeend', | ||
createGalleryItemsMarkup(galleryItems) | ||
); | ||
console.dir(galleryContainer); | ||
|
||
let gallery = new SimpleLightbox('.gallery a', { | ||
captionsData: 'alt', | ||
captionDelay: 250, | ||
}); |
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,41 @@ | ||
import Player from '@vimeo/player'; | ||
console.log(Player); | ||
|
||
const throttle = require('lodash.throttle'); | ||
|
||
const iframe = document.querySelector('#vimeo-player'); | ||
console.log(iframe); | ||
|
||
const player = new Player(iframe); | ||
|
||
// player.on('play', function () { | ||
// console.log('played the video!'); | ||
// }); | ||
|
||
const LS_KEY = 'videoplayer-current-time'; | ||
|
||
const onPlay = function (data) { | ||
// data is an object containing properties specific to that event | ||
localStorage.setItem(LS_KEY, JSON.stringify(data.seconds)); | ||
}; | ||
|
||
player.on('timeupdate', throttle(onPlay, 1000)); | ||
|
||
const LSTime = Number(localStorage.getItem(LS_KEY)); | ||
|
||
player | ||
.setCurrentTime(LSTime) | ||
.then(function (seconds) { | ||
// seconds = the actual time that the player seeked to | ||
}) | ||
.catch(function (error) { | ||
switch (error.name) { | ||
case 'RangeError': | ||
// the time was less than 0 or greater than the video’s duration | ||
break; | ||
|
||
default: | ||
// some other error occurred | ||
break; | ||
} | ||
}); |