Skip to content

Commit

Permalink
--
Browse files Browse the repository at this point in the history
  • Loading branch information
sainathmurali committed Dec 30, 2023
1 parent b6b7cd0 commit 267b214
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,36 +143,38 @@ <h3 class="alt-features-title1 font-alt"><b>Recent News</b></h3>
$("#footer").load("footer.html");
});
</script>
<script>
$(document).ready(function() {
// Check the page width on load and resize
$(window).on('load resize', function() {
// Get the current page width
var pageWidth = $(window).width();
if (pageWidth > 1200) {
// Add a padding of 100 pixels to the top of the section
$('.home-section').css('height', '1061px');
}
else if ((pageWidth >500) & (pageWidth <1200)) {
$('.home-section').css('height', 1061+200 - (1400-pageWidth));
}
else if (pageWidth <500) {
$('.home-section').css('height', 1061+200 - (1400-500));
}

// If the page width is more than 1428 pixels
//if ((pageWidth > 500) & (pageWidth < 1061)) {
// Add a padding of 100 pixels to the top of the section
//$('.home-section').css('height', pageWidth);
//} else if (pageWidth > 1061){
// Remove the padding if the page width is 1428 pixels or less
//$('.home-section').css('height', '1061px');
//}else if (pageWidth < 500){
// Remove the padding if the page width is 1428 pixels or less
//$('.home-section').css('height', '500px');
//}
});
});
</script>
<script>
$(document).ready(function() {
// Function to update section height based on page width
function updateSectionHeight() {
var pageWidth = $(window).width();
if (pageWidth > 1200) {
$('.home-section').css('height', '1061px');
} else if (pageWidth > 500 && pageWidth <= 1200) {
$('.home-section').css('height', 1061 + 200 - (1400 - pageWidth));
} else if (pageWidth <= 500) {
$('.home-section').css('height', 1061 + 200 - (1400 - 500));
}
}

// Initial update on page load
updateSectionHeight();

// Update on page resize
$(window).on('resize', function() {
updateSectionHeight();
});

// Update on page scroll (debounced for performance)
var debounceTimeout;
$(window).on('scroll', function() {
clearTimeout(debounceTimeout);
debounceTimeout = setTimeout(function() {
updateSectionHeight();
}, 250);
});
});
</script>

</body>
</html>

0 comments on commit 267b214

Please sign in to comment.