Agriculture App
Agriculture Helper
Weather Forecast
Sunny with a chance of rain tomorrow.
Farming Tips
- Rotate crops to maintain soil health.
- Use organic fertilizers for better yield.
- Water plants early in the morning.
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
text-align: center;
}
h1 {
color: #4CAF50;
}
.tabs {
margin-bottom: 20px;
}
.tab-button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
margin: 5px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
.tab-button.active {
background-color: #45a049;
}
.tab-button:hover {
background-color: #45a049;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
ul {
list-style-type: none;
padding: 0;
}
li {
margin: 10px 0;
}
// Get all tab buttons and content
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');
// Add event listeners to tab buttons
tabButtons.forEach(button => {
button.addEventListener('click', () => {
// Remove active class from all buttons and content
tabButtons.forEach(btn => btn.classList.remove('active'));
tabContents.forEach(content => content.style.display = 'none');
// Add active class to the clicked button
button.classList.add('active');
// Show the corresponding content
const tabId = button.getAttribute('data-tab');
document.getElementById(tabId).style.display = 'block';
});
});
// Show the default tab (Crops) on page load
document.querySelector('.tab-button.active').click();
No comments:
Post a Comment