Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made a carousel #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

made a carousel #1

wants to merge 2 commits into from

Conversation

nimdolphin
Copy link
Owner

No description provided.

index.html Outdated
<title>Carousel</title>
</head>
<body>
<img class="arcticmonkeys" src="./img/photo1.jpg" alt="Alex">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create with a loop

what if I want you to add 10000 images to the carousel?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

index.js Outdated

let index = 0;

function clickLeft() {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

index.js Outdated
clickL.addEventListener(
"click",
(clickLeft = () => {
if (index === 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If !index

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

index.js Outdated
index--;

elems[index].style.display = "block";
point[index].style.background = "Burlywood";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much copy paste

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

index.js Outdated
clickR.addEventListener(
"click",
(clickRight = () => {
if (index >= elems.length - 1) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}

.btn-left:hover {
background-color: white;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, we don’t use colors like this
only hex

And you should add variables

.btn-right {
position: absolute;
top: 48%;
right: 31%;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost All styles are copy paste

<input id="clickR" type="button" value=" " class="btn-right">

<div id="main">
<div class="point"></div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to create it dynamically

@@ -0,0 +1,86 @@
const images = [
"./img/photo1.jpg",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a dynamic array and use indexes

What if you have 100000 images?


const point = document.getElementsByClassName("point");

elems[0].style.display = "block";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u do it while creative the element?

point[0].style.background = "Burlywood";

function createButtons() {
const clickL = document.getElementById("clickL");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean clickL?


let index = 0;

function addChangeNone() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddChangeNone? Rename


clickL.addEventListener(
"click",
(clickLeft = () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is it’�?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants