Skip to content

Commit

Permalink
new section
Browse files Browse the repository at this point in the history
  • Loading branch information
nkpn committed Aug 17, 2024
1 parent bef2aae commit 162c763
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 138 deletions.
Binary file added images/Avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 43 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ <h5 class="text-xl plan-name">Plan Name</h5>
<img src="./icons/default-icon.svg" alt="Feature">
</div>
<h5 class="text-xl plan-name">Plan Name</h5>
<p class="card-price">$100</p>
<p class="card-price">$250</p>
<p class="text-md card-caption">Caption</p>
<ul class="features-list">
<li class="features-item">
Expand Down Expand Up @@ -433,7 +433,7 @@ <h5 class="text-xl plan-name">Plan Name</h5>
<img src="./icons/default-icon.svg" alt="Feature">
</div>
<h5 class="text-xl plan-name">Plan Name</h5>
<p class="card-price">$100</p>
<p class="card-price">$500</p>
<p class="text-md card-caption">Caption</p>
<ul class="features-list">
<li class="features-item">
Expand Down Expand Up @@ -499,9 +499,50 @@ <h4 class="display-md">Nulla sed diam ornare, porta risus ut, hendrerit nibh</h4
<h4 class="display-md">Lorem ipsum dolor sit amet</h4>
<p class="text">Donec at mauris nunc. Curabitur non congue sapien, sit amet vestibulum libero. Mauris neque sem, mattis non nibh in, porta lobortis quam.</p>
</div>

<div class="testimonials-carousel">
<!-- 1 -->
<div class="testimonials-card">
<img class="avatar" src="./images/Avatar.png" alt="Avatar">
<p class="card-text">Nulla sed diam ornare, porta risus ut, hendrerit nibh. Cras sit amet accumsan velit, et iaculis justo. Maecenas elementum eros vitae purus aliquam, vel pretium odio efficitur.</p>
<p class="text-lg card-name">Name Surname</p>
<p class="text-md caption">Caption</p>
</div>
<!-- 2 -->
<div class="testimonials-card">
<img class="avatar" src="./images/Avatar.png" alt="Avatar">
<p class="card-text">Nulla sed diam ornare, porta risus ut, hendrerit nibh. Cras sit amet accumsan velit, et iaculis justo. Maecenas elementum eros vitae purus aliquam, vel pretium odio efficitur.</p>
<p class="text-lg card-name">Name Surname</p>
<p class="text-md caption">Caption</p>
</div>
<!-- 3 -->
<div class="testimonials-card">
<img class="avatar" src="./images/Avatar.png" alt="Avatar">
<p class="card-text">Nulla sed diam ornare, porta risus ut, hendrerit nibh. Cras sit amet accumsan velit, et iaculis justo. Maecenas elementum eros vitae purus aliquam, vel pretium odio efficitur.</p>
<p class="text-lg card-name">Name Surname</p>
<p class="text-md caption">Caption</p>
</div>
</div>
</div>
</section>
<!-- End of Testimonals section -->
<!-- CTA Section -->
<section class="section cta-section">
<div class="container">
<div class="two-columns-wrapper">
<div class="cta-text">
<h5 class="display-md">Lorem ipsum dolor sit amet</h5>
<p class="text-xl">Donec purus metus, lacinia eget nunc id, consequat maximus nulla. Maecenas velit mauris, imperdiet sit amet diam pretium, blandit efficitur turpis.</p>
</div>
</div>
<div class="cta-form">
<form action="post">

</form>
</div>
</div>
</section>
<!-- End of CTA Section -->
</main>

<!-- Scroll to top button -->
Expand Down
290 changes: 166 additions & 124 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,132 +1,174 @@
// Function for "Scrol to top" button
function scrollToTop() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}

// Mobile Header Menu Show / Hide function
document.addEventListener("DOMContentLoaded", function() {
const toggleCheckbox = document.getElementById("toggle");
const mobileMenu = document.querySelector(".mobile-menu");

if (mobileMenu && toggleCheckbox) {
toggleCheckbox.addEventListener("change", function() {
if (toggleCheckbox.checked) {
mobileMenu.classList.add('opened')
setTimeout(() => {
mobileMenu.style.display = "flex";
}, 200);
} else {
mobileMenu.classList.remove('opened')
setTimeout(() => {
mobileMenu.style.display = "none";
}, 300);
}
});
// Function for "Scrol to top" button
function scrollToTop() {
console.log('click')
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
});


// news section Slick slider initialization
$(".news .carousel").slick({
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
speed: 300,
dots: true,
arrows: true,
appendArrows: $(".carousel-buttons"),
prevArrow: $(".slider-left"),
nextArrow: $(".slider-right"),
});

// pricing section carousel
$(".pricing-carousel").slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 3,
speed: 300,
responsive: [
{
breakpoint: 2048,
settings: {
slidesToShow: 3,
slidesToScroll: 1,

const scrollToTopButton = document.querySelector('.scroll-top-btn');
scrollToTopButton.addEventListener('click', scrollToTop)

// Mobile Header Menu Show / Hide function

const toggleCheckbox = document.getElementById("toggle");
const mobileMenu = document.querySelector(".mobile-menu");

if (mobileMenu && toggleCheckbox) {
toggleCheckbox.addEventListener("change", function() {
if (toggleCheckbox.checked) {
mobileMenu.classList.add('opened')
setTimeout(() => {
mobileMenu.style.display = "flex";
}, 200);
} else {
mobileMenu.classList.remove('opened')
setTimeout(() => {
mobileMenu.style.display = "none";
}, 300);
}
});
}



// news section Slick slider initialization
$(".news .carousel").slick({
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
speed: 300,
dots: true,
arrows: true,
appendArrows: $(".carousel-buttons"),
prevArrow: $(".slider-left"),
nextArrow: $(".slider-right"),
});

// pricing section carousel
$(".pricing-carousel").slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 3,
speed: 300,
responsive: [
{
breakpoint: 2048,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
},
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
centerMode: true,
centerPadding: '24px'
},
},
},
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
},
},
},
],
});

// Calculator Logic

const amountSlider = document.getElementById('amount');
const periodSlider = document.getElementById('period');
const amountValue = document.getElementById('amount-value');
const periodValue = document.getElementById('period-value');
const weeklyIncome = document.getElementById('weekly-income');

// Function to format number as currency
function formatCurrency(value) {
return value.toLocaleString()
}

// Function to update the displayed values and calculate weekly income
function updateValues() {
const amount = parseInt(amountSlider.value);
const period = parseInt(periodSlider.value);

amountValue.textContent = `$ ${formatCurrency(amount)}`;
periodValue.textContent = `${period} year${period > 1 ? 's' : ''}`;

// Example formula for weekly income calculation
const annualInterestRate = 0.5;
const totalIncome = amount * Math.pow(1 + annualInterestRate, period);
const weeklyIncomeValue = ((totalIncome - amount) / (period * 52)).toFixed(2);

weeklyIncome.textContent = `$ ${formatCurrency(parseFloat(weeklyIncomeValue))}`;
}

// Event listeners for sliders
if (amountSlider && periodSlider && amountValue && periodValue && weeklyIncome) {
amountSlider.addEventListener('input', updateValues);
periodSlider.addEventListener('input', updateValues);
}

// Initial update
updateValues();

// Slider background logic to update
function updateSliderBackground(slider, sliderValue) {
const progress = (sliderValue / slider.max) * 100;
slider.style.background = `linear-gradient(to right, #4E6CFF ${progress}%, #EEF1FF ${progress}%)`
}

if (amountSlider && amountValue){
updateSliderBackground(amountSlider, amountSlider.value);
amountSlider.addEventListener("input", function(event) {
updateSliderBackground(amountSlider, event.target.value);
],
});
}

if (periodSlider && periodValue){
/* -0.5 because slider has little step and because of this the background gradient is too large */
updateSliderBackground(periodSlider, periodSlider.value -0.5 );
periodSlider.addEventListener("input", function(event) {
updateSliderBackground(periodSlider, event.target.value - 0.5)
})
}
// testimonials section carousel
$(".testimonials-carousel").slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 3,
speed: 300,
responsive: [
{
breakpoint: 2048,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
centerMode: true,
centerPadding: '24px'
},
},
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
},
},
],
});

// Calculator Logic

const amountSlider = document.getElementById('amount');
const periodSlider = document.getElementById('period');
const amountValue = document.getElementById('amount-value');
const periodValue = document.getElementById('period-value');
const weeklyIncome = document.getElementById('weekly-income');

// Function to format number as currency
function formatCurrency(value) {
return value.toLocaleString()
}

// Function to update the displayed values and calculate weekly income
function updateValues() {
const amount = parseInt(amountSlider.value);
const period = parseInt(periodSlider.value);

amountValue.textContent = `$ ${formatCurrency(amount)}`;
periodValue.textContent = `${period} year${period > 1 ? 's' : ''}`;

// Example formula for weekly income calculation
const annualInterestRate = 0.5;
const totalIncome = amount * Math.pow(1 + annualInterestRate, period);
const weeklyIncomeValue = ((totalIncome - amount) / (period * 52)).toFixed(2);

weeklyIncome.textContent = `$ ${formatCurrency(parseFloat(weeklyIncomeValue))}`;
}

// Event listeners for sliders
if (amountSlider && periodSlider && amountValue && periodValue && weeklyIncome) {
amountSlider.addEventListener('input', updateValues);
periodSlider.addEventListener('input', updateValues);
}

// Initial update
updateValues();

// Slider background logic to update
function updateSliderBackground(slider, sliderValue) {
const progress = (sliderValue / slider.max) * 100;
slider.style.background = `linear-gradient(to right, #4E6CFF ${progress}%, #EEF1FF ${progress}%)`
}

if (amountSlider && amountValue){
updateSliderBackground(amountSlider, amountSlider.value);
amountSlider.addEventListener("input", function(event) {
updateSliderBackground(amountSlider, event.target.value);
});
}

if (periodSlider && periodValue){
/* -0.5 because slider has little step and because of this the background gradient is too large */
updateSliderBackground(periodSlider, periodSlider.value -0.5 );
periodSlider.addEventListener("input", function(event) {
updateSliderBackground(periodSlider, event.target.value - 0.5)
})
}


});
3 changes: 2 additions & 1 deletion sass/components/_styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ h2,
font-family: $font;
font-size: 16px;
line-height: 24px;
font-weight: 500;
font-weight: 400;
color: $textSecondary;
}

Expand Down Expand Up @@ -223,6 +223,7 @@ h2,
bottom: 120px;
right: 16px;
cursor: pointer;
z-index: 50;

&:hover {
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.15);
Expand Down
Loading

0 comments on commit 162c763

Please sign in to comment.