-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
footer.php
53 lines (39 loc) · 1.72 KB
/
footer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<script src="assets/js/bootstrap4.5.2.bundle.min.js"></script>
<script src="assets/js/bootstrap5.3.bundle.min.js"></script>
<script src="assets/js/jquery-3.5.1.slim.min.js"></script>
<script>
// JavaScript function to change tabs and scroll to the table when cards are clicked
function changeTab(tabName) {
$('.nav-tabs .nav-link').removeClass('active');
$('.tab-pane').removeClass('show active');
if (tabName === 'out-of-stock') {
$('#out-of-stock-tab').addClass('active');
$('#out-of-stock').addClass('show active');
$('html, body').animate({
scrollTop: $('#out-of-stock').offset().top
}, 500); // Scroll to out of stock table
} else if (tabName === 'low-stock') {
$('#low-stock-tab').addClass('active');
$('#low-stock').addClass('show active');
$('html, body').animate({
scrollTop: $('#low-stock').offset().top
}, 500); // Scroll to low stock table
}
}
// Function to scroll to top
function scrollToTop() {
$('html, body').animate({scrollTop: 0}, 500); // Scroll to top smoothly
}
// Show/Hide Go to Top Button
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('#goTopBtn').fadeIn(); // Show button if scrolled down
} else {
$('#goTopBtn').fadeOut(); // Hide button if near top
}
});
</script>
<!-- Go to Top Button -->
<button id="goTopBtn" onclick="scrollToTop()">↑</button>
</body>
</html>