Skip to content

Commit 0ad7350

Browse files
committed
Revert "Added animated counter"
This reverts commit 5a9c990.
1 parent 68cd17a commit 0ad7350

File tree

4 files changed

+94
-106
lines changed

4 files changed

+94
-106
lines changed

index.html

+27-6
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,22 @@ <h6>Data Analytics Projects</h6>
161161
<div class="container">
162162
<div class="pointerBtn">
163163
<i class="far fa-clock fa-4x"></i>
164-
<div class="counter" data-target="72">0+</div>
164+
<div class="counter" data-target="24">24+</div>
165165
<h3>Working Hours/Week</h3>
166166
</div>
167167
<div class="pointerBtn">
168168
<i class="fas fa-gift fa-4x"></i>
169-
<div class="counter" data-target="100">0+</div>
169+
<div class="counter" data-target="60">60+</div>
170170
<h3>Projects Sold</h3>
171171
</div>
172172
<div class="pointerBtn">
173173
<i class="fas fa-users fa-4x"></i>
174-
<div class="counter" data-target="92">0+</div>
174+
<div class="counter" data-target="52">52+</div>
175175
<h3>Happy Clients</h3>
176176
</div>
177177
<div class="pointerBtn">
178178
<i class="fas fa-award fa-4x"></i>
179-
<div class="counter" data-target="83"><span>0</span>+</div>
179+
<div class="counter" data-target="13">13+</div>
180180
<h3>Awards Received</h3>
181181
</div>
182182
</div>
@@ -327,7 +327,7 @@ <h3 class="chatbox__title">Precious IT Services</h3>
327327
</div>
328328
</div>
329329
<!-- chat bot finish -->
330-
330+
331331
<script src="./js/contact.js"></script>
332332
<script src="./chatBot/script.js"></script>
333333
<script src="./js/login.js"></script>
@@ -338,6 +338,27 @@ <h3 class="chatbox__title">Precious IT Services</h3>
338338
alert("Under Maintenance, Please come again after sometime.")
339339
</script> -->
340340

341-
341+
<script>
342+
// Function to scroll to the top smoothly
343+
function scrollToTop() {
344+
window.scrollTo({
345+
top: 0,
346+
behavior: "smooth",
347+
});
348+
}
349+
350+
// Add an event listener to the "scroll to top" button
351+
const backToTopButton = document.querySelector(".back-to-top");
352+
backToTopButton.addEventListener("click", scrollToTop);
353+
354+
// Add an event listener to show/hide the button based on scroll position
355+
window.addEventListener("scroll", () => {
356+
if (document.documentElement.scrollTop > 100) {
357+
backToTopButton.style.display = "block";
358+
} else {
359+
backToTopButton.style.display = "none";
360+
}
361+
});
362+
</script>
342363
</body>
343364
</html>

main.js

+66-75
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,74 @@
1-
$(document).ready(function () {
2-
$('.fa-bars').click(function () {
3-
$(this).toggleClass('fa-times');
4-
$('.navbar').toggleClass('nav-toggle');
5-
});
1+
$(document).ready(function(){
62

7-
$(window).on('load scroll', function () {
8-
$('.fa-bars').removeClass('fa-times');
9-
$('.navbar').removeClass('nav-toggle');
3+
$('.fa-bars').click(function(){
4+
$(this).toggleClass('fa-times');
5+
$('.navbar').toggleClass('nav-toggle');
6+
});
107

11-
if ($(window).scrollTop() > 35) {
12-
$('.header').css({
13-
'background': '#002e5f',
14-
'box-shadow': '0 .2rem .5rem rgba(0,0,0,.4)'
15-
});
16-
$('.login').css({
17-
'background': '#227EBB',
18-
'box-shadow': 'none'
19-
});
20-
} else {
21-
$('.header').css({
22-
'background': 'none',
23-
'box-shadow': 'none'
24-
});
25-
$(".login").css({
26-
'background': '#002e5f'
27-
});
28-
}
29-
});
8+
$(window).on('load scroll',function(){
9+
$('.fa-bars').removeClass('fa-times');
10+
$('.navbar').removeClass('nav-toggle');
3011

31-
// Function to start counting for a single counter
32-
function startCounter(counterElement, target) {
33-
let count = 0;
34-
const speed = Math.ceil(target / 200); // Adjust the speed as needed
12+
if($(window).scrollTop()>35)
13+
{
14+
$('.header').css({'background':'#002e5f','box-shadow':'0 .2rem .5rem rgba(0,0,0,.4)'});
15+
$('.login').css({'background':'#227EBB','box-shadow':'none'});
16+
}
17+
else
18+
{
19+
$('.header').css({'background':'none','box-shadow':'none'});
20+
$(".login").css({ background: "#002e5f" });
21+
}
22+
});
3523

36-
const updateCounter = () => {
37-
if (count < target) {
38-
count += speed;
39-
$(counterElement).text(count + "+");
40-
setTimeout(updateCounter, 10);
41-
} else {
42-
$(counterElement).text(target + "+");
43-
}
44-
};
4524

46-
updateCounter();
47-
}
25+
(function ($) {
26+
"use strict";
27+
28+
// $(".clients-carousel").owlCarousel({
29+
// autoplay: true,
30+
// dots: true,
31+
// loop: true,
32+
// responsive: { 0: {items: 2}, 768: {items: 4}, 900: {items: 6} }
33+
// });
4834

49-
// Function to check if an element is in viewport with an offset
50-
function isInViewport(element, offset = 100) {
51-
const rect = element.getBoundingClientRect();
52-
return (
53-
rect.top >= 0 &&
54-
rect.left >= 0 &&
55-
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) + offset &&
56-
rect.right <= (window.innerWidth || document.documentElement.clientWidth) + offset
57-
);
58-
}
35+
// $(".testimonials-carousel").owlCarousel({
36+
// autoplay: true,
37+
// dots: true,
38+
// loop: true,
39+
// responsive: { 0: {items: 1}, 576: {items: 2}, 768: {items: 3}, 992: {items: 4} }
40+
// });
41+
42+
})(jQuery);
43+
})
5944

60-
function initCounters() {
61-
$(".container").each(function () {
62-
const target = parseInt($(this).data("target"));
63-
if (isInViewport(this, 700)) { // Adjust the offset as needed
64-
startCounter(this, target);
65-
}
66-
});
67-
}
68-
69-
// Add a scroll event listener to start counters when in view
70-
$(window).on('scroll', function () {
71-
$('.counter').each(function () {
72-
if (isInViewport(this, 700) && !$(this).hasClass('counted')) { // Adjust the offset as needed
73-
console.log('Counter in view:', this); // Debug log
74-
$(this).addClass('counted');
75-
const target = parseInt($(this).data('target'));
45+
$(document).ready(function() {
46+
// Function to start counting for a single counter
47+
function startCounter(counterElement, target) {
48+
let count = 0;
49+
const speed = Math.ceil(target / 200); // Adjust the speed as needed
50+
51+
const updateCounter = () => {
52+
if (count < target) {
53+
count += speed;
54+
$(counterElement).text(count + "+");
55+
setTimeout(updateCounter, 10);
56+
} else {
57+
$(counterElement).text(target + "+"); // Ensure the final value is accurate
58+
}
59+
};
60+
61+
updateCounter();
62+
}
63+
64+
// Function to initialize all counters
65+
function initCounters() {
66+
$(".counter").each(function() {
67+
const target = parseInt($(this).data("target"));
7668
startCounter(this, target);
77-
}
78-
});
79-
});
80-
81-
// Initial check to start counters if already in view
82-
$(window).trigger('scroll');
83-
});
69+
});
70+
}
71+
72+
// Call the initCounters function when the document is ready
73+
initCounters();
74+
});

package-lock.json

-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
"lib": "lib"
88
},
99
"scripts": {
10-
"test": "echo \"Error: no test specified\" && exit 1",
11-
"start": "node index.js",
12-
"dev": "nodemon index.js"
10+
"test": "echo \"Error: no test specified\" && exit 1"
1311
},
1412
"keywords": [],
1513
"author": "",
@@ -22,7 +20,6 @@
2220
"@sendgrid/mail": "^7.7.0",
2321
"express": "^4.18.2",
2422
"html-to-text": "^9.0.5",
25-
"node": "^20.14.0",
2623
"nodemailer": "^6.9.13",
2724
"nodemailer-smtp-transport": "^2.7.4",
2825
"razorpay": "^2.9.2"

0 commit comments

Comments
 (0)