Skip to content

Commit

Permalink
add css
Browse files Browse the repository at this point in the history
  • Loading branch information
Maryna-511750 committed Oct 22, 2023
1 parent 8c07ee4 commit ac49fab
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 53 deletions.
30 changes: 29 additions & 1 deletion css/index.cases.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
#cases {
padding: 18px;
}
}

.cases-content{
display: grid;
grid-template-columns: auto auto;
gap: 10px;
background-color: inherit;
padding: 10px;
}

.cases-item-big {
/*grid-column: 1 / 3;*/
grid-row: 1 / span 2;
}

.cases-item .cases-paragraph-hidden {
display: none;
}

.cases-item-big .cases-paragraph-hidden {
display: block;
}

/*@media (min-width: 774px) {
.cases-item-big {
grid-column: 1 / 1;
grid-row: 1 / span 2;
}
}*/
2 changes: 1 addition & 1 deletion css/index.nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
display: flex;
flex-direction: column;
max-width: 100%;
margin: 30px auto;
margin: 50px auto;
}

.navigation_content a,
Expand Down
11 changes: 1 addition & 10 deletions css/index.services.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}

.services-carousel-item {
flex: 0 0 100%;
flex: 0 0 calc(100% - 10px);
margin-right: 10px;
text-align: center;
/*display: flex;
Expand Down Expand Up @@ -50,13 +50,4 @@
.next-button:hover {
background-color: #555;
}


.prev-button {
float: left;
}

.next-button {
float: right;
}

18 changes: 7 additions & 11 deletions html/index.cases.partial.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
<section id="cases" class="container">
<h2>Best Cases</h2>
<div>
<div>
<img src="#" alt="">
<div>
<div class="cases-content">
<div class="cases-item cases-item-big">
<p>In favor of the plaintiff, $ 13,500 was recovered from the respondent
surgeon for improperly performing cosmetic surgery for correcting the shape of the plaintiff’s nose. </p>
<p>The plaintiff claimed that she, as a patient, had entered into a contract with the surgeon,
<p class="cases-paragraph-hidden">The plaintiff claimed that she, as a patient, had entered into a contract with the surgeon,
and he agreed to perform plastic surgery of her nose in order to increase her aesthetic appeal.
The appearance of the plaintiff didn't improve, actually,
her face was disfigured. I helped the woman to receive her pain and suffering money.</p>
</div>
<div>
<div class="cases-item">
<p>On 04.03.2017, the Family Court of the State of New York satisfied the claims of attorney William Rhoades.
in the interests of the Client about deprivation of parental rights.</p>
<p>The court recognized that the father must be deprived of parental rights,
<p class="cases-paragraph-hidden">The court recognized that the father must be deprived of parental rights,
as he does not fulfill his obligations to the child in accordance with the norms of the Family Law.
It was a difficult case, but I have proven that the presence of the father negatively affects the child,
causes aggression in him immediately and destroys the psyche.</p>
</div>
<div>
<div class="cases-item">
<p>In June 2019, the inheritance division case was considered at the Surrogate’s Court of the State of New York.
The plaintiff insisted that his father died without leaving a will, and the plaintiff is the primary heir. </p>
<p>I helped the plaintiff to prove to the court that he is the successor, and can count on 80% of the
<p class="cases-paragraph-hidden">I helped the plaintiff to prove to the court that he is the successor, and can count on 80% of the
entire inheritance, which included significant amounts in accounts in banks of America,
as well as 3 mansions in Hampton, a yacht fleet and 500 square meters of commercial real estate in NY.</p>
</div>
</div>

</div>
</section>
12 changes: 12 additions & 0 deletions js/cases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const casesItem = document.querySelectorAll('.cases-item');
let previousCaseItem = null;

casesItem.forEach((caseItem) => {
caseItem.addEventListener('mouseover', (_) => {
if (previousCaseItem !== null) {
previousCaseItem.classList.remove('cases-item-big');
}
caseItem.classList.add('cases-item-big');
previousCaseItem = caseItem;
});
});
1 change: 1 addition & 0 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
document.addEventListener('partialsLoaded', async () => {
await import('./nav.js');
await import('./services.js');
await import('./cases.js');
});
52 changes: 22 additions & 30 deletions js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,31 @@
prevButton.addEventListener('click', moveToPrev);
nextButton.addEventListener('click', moveToNext);
});*/
const carousel = document.querySelector('.services-carousel');
const prevButton = document.querySelector('.prev-button');
const nextButton = document.querySelector('.next-button');


const itemWidth = carousel.querySelector('.services-carousel-item').offsetWidth;


let currentPosition = 0;
const servicesCarousel = document.querySelector('.services-carousel');
const prevButton = document.querySelector('.prev-button');
const nextButton = document.querySelector('.next-button');
const slideWidth = servicesCarousel.querySelector('.services-carousel-item').offsetWidth;
let currentPosition = 0;


function moveToNext() {
currentPosition += itemWidth;
if (currentPosition > 0) {
currentPosition = -(itemWidth * (carousel.children.length - 1));
function moveToNext() {
currentPosition += slideWidth;
if (currentPosition > 0) {
currentPosition = -(slideWidth * (servicesCarousel.children.length - 1));
}
updateCarouselPosition();
}
updateCarouselPosition();
}


function moveToPrev() {
currentPosition -= itemWidth;
if (currentPosition < -(itemWidth * (carousel.children.length - 1))) {
currentPosition = 0;
function moveToPrev() {
currentPosition -= slideWidth;
if (currentPosition < -(slideWidth * (servicesCarousel.children.length - 1))) {
currentPosition = 0;
}
updateCarouselPosition();
}
updateCarouselPosition();
}


function updateCarouselPosition() {
carousel.style.transform = `translateX(${currentPosition}px)`;
}
function updateCarouselPosition() {
servicesCarousel.style.transform = `translateX(${currentPosition}px)`;
}


prevButton.addEventListener('click', moveToPrev);
nextButton.addEventListener('click', moveToNext);
prevButton.addEventListener('click', moveToPrev);
nextButton.addEventListener('click', moveToNext);

0 comments on commit ac49fab

Please sign in to comment.