created basic implementation of slideshow

This commit is contained in:
Nye Evans 2021-01-02 17:03:44 +00:00
parent ea75670078
commit c1881907db
7 changed files with 30 additions and 19 deletions

BIN
images/Favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View file

@ -1,24 +1,28 @@
import {slidem, slides} from "/gallery-index.js"; import {slide, slides} from "../pages/gallery-index.js";
var currentSlide = 0; var currentSlide = 0;
function nextSlide(){ window.nextSlide = function nextSlide(){
currentSlide++; currentSlide++;
updateSlide(); updateSlide();
} }
function lastSlide(){ window.lastSlide = function lastSlide(){
currentSlide--; currentSlide--;
updateSlide(); updateSlide();
} }
function updateSlide(){ function updateSlide(){
if (currentSlide > slides.length){ if (currentSlide > slides.length-1){
currentSlide = 0; currentSlide = 0;
} else if (currentSlide < 0){ } else if (currentSlide < 0){
currentSlide = slides.length; currentSlide = slides.length-1;
} }
document.getElementById("programGalleryTitle").innerHTML = slides[currentSlide].title;
console.log(slides[currentSlide]); document.getElementById("programGalleryCaption").innerHTML = slides[currentSlide].caption;
document.getElementById("programGalleryImage").src = slides[currentSlide].image;
document.getElementById("programGalleryLink").href = slides[currentSlide].link;
} }
console.log("script loaded");

View file

@ -2,10 +2,11 @@
<header> <header>
<link rel = "stylesheet" href = "Mainpage.css"> <link rel = "stylesheet" href = "Mainpage.css">
<script src = "\gallery.js" type = "module"></script> <link rel = "icon" href = "..\images\Favicon.ico">
<meta charset="UTF-8"> <meta charset="UTF-8">
<script src = "gallery.js" type = "module"></script>
<title>Nye Evans Portfolio</title> <title>Nye Evans Portfolio</title>
</header> </header>
@ -38,11 +39,11 @@
</div> </div>
<div id = "programGallery"> <div id = "programGallery">
<img src = "gallery\Cat_tower_defense\projectHeaderImage.png" class = "GalleryImage"> <a href = "\gallery\Cat_tower_defense\cat-tower-defense.html" class = "GalleryImage" id = "programGalleryLink"><img src = "gallery\Cat_tower_defense\projectHeaderImage.png" class = "GalleryImage" id = "programGalleryImage"></a>
<p class = "GalleryTitle orangeBack">Image Title</p> <p class = "GalleryTitle orangeBack" id = "programGalleryTitle">Image Title</p>
<p class = "GalleryCaption orangeBack">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <p class = "GalleryCaption orangeBack" id = "programGalleryCaption">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<button class = "GalleryLeftArrow" onClick = lastSlide()></button> <button class = "GalleryLeftArrow" onClick = "window.parent.lastSlide();"></button>
<button class = "GalleryRightArrow" onClick = nextSlide()></button> <button class = "GalleryRightArrow" onClick = "window.parent.nextSlide();"></button>
</div> </div>
<div id = "personalGallery" style = "margin-bottom: 40vh;"> <div id = "personalGallery" style = "margin-bottom: 40vh;">

View file

@ -1,11 +1,12 @@
export class slide{ export class slide{
constructor(title, caption, image){ constructor(title, caption, image, link){
this.title = title; this.title = title;
this.caption = caption; this.caption = caption;
this.image = image; this.image = image;
this.link = link;
} }
}; }
export var slides = [slide(), export var slides = [new slide("john", "he is john", "gallery/Cat_tower_defense/projectHeaderImage.png"),
slide(), new slide("james", "he is james", "gallery/EPQ_project/projectHeaderImage.png"),
slide() new slide("jack", "he is jack", "gallery/Room_builder/projectHeaderImage.png")
] ];

View file

@ -0,0 +1,5 @@
<HMTL>
<body>
dgsdfsdfsfsf
</body>
</HMTL>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB