the data-types on the different li pricing plans describe the two types of options, on the school option, i have added a new 2 year plan but it is interfering with the prep view. The prep li are four with the fourth as a transparent(is-hidden) li for the placeholder of the extra school li. I want the prep view to strictly show 3 li and add the 4 only when li with data type school are visible four the fourth 2 year plan and also the 4 plans should be centered on the screen. This is a design css issue i need fixed:
Prep Courses
Nursing School
Monthly
</span>
<span class="value">59</span>
<span class="duration">month</span>
</div>
<br><br>
</div>
<div class="pricing-body">
<ul class="pricing-features">
<li><em>ALL</em> Courses</li>
<li><em>30</em> Days of access</li>
<li><em>24/7</em> Dedicated Support</li>
<li> Performance tracking</li>
<li> Questions and well-detailed explanation</li>
<li> Detailed performnce analysis available <br> upon completion</li>
</ul>
</div>
<div class="footer pricing-footer">
<button class="select" onclick="submitForm('PREP COURSES MONTHLY', 59)">Get Started Now</button>
</div>
</li>
<!-- <li data-type="school" class="is-hidden" style="height: 700px;">
<div class="header pricing-header">
<div class="price">
</div>
</div>
<div class="pricing-body" style="padding-top: 25px;">
<ul class="pricing-features">
<li style="font-size: 3.5rem; font-weight: 600; color: #4e1249;"> Thank You</li>
<li style="font-size: 2.9rem; font-weight: 700; color: #6c1865;"> For</li>
<li style="font-size: 2.9rem; font-weight: 800; color: #8f2086;"> Your</li>
<li style="font-size: 3.5rem; font-weight: 900; color: #a12597;"> Patience.</li>
</ul>
</div>
<div class="footer pricing-footer">
</div>
</li> -->
<li data-type="school" class="is-hidden">
<div class="header pricing-header">
<h2>Monthly</h2>
<div class="price">
<span class="currency">
30
month
ALL Topics
30 Days of access
24/7 Dedicated Support
Performance tracking
Questions and well-detailed explanation
Detailed performance analysis available upon completion
Get Started Now
3 Months
150
All Courses
6 Months of access
24/7 Dedicated Support
Performance tracking
Questions and well-detailed explanation
Detailed performance analysis available upon completion
Get Started Now
6 Months
138
All Topics
6 Months of access
24/7 Dedicated Support
Performance tracking
Questions and well-detailed explanation
Detailed performance analysis available upon completion
Get Started Now
6 Months
240
ALL Courses
1 Year of access
24/7 Dedicated Support
Performance tracking
Questions and well-detailed explanation
Detailed performnce analysis available upon completion
Get Started Now
One Year
216
ALL Topics
1 Year of access
24/7 Dedicated Support
Performance tracking
Questions and well-detailed explanation
Detailed performance analysis available upon completion
Get Started Now
Two Years
288
ALL Topics
2 Years of access
24/7 Dedicated Support
Performance tracking
Questions and well-detailed explanation
Detailed performance analysis available upon completion
Get Started Now
CSS: .price {
margin-bottom: 8px;
}
From what I understand, you've added an additional pricing plan for the "school" category and this has caused alignment and visibility issues, especially in the "prep" view. Here's how you can address the issues to ensure that the pricing list maintains its intended display, with only 3 items visible for "prep" plans and 4 items for "school" plans when necessary, all while keeping them centered on the screen.
1. CSS Adjustments for Visibility and Alignment:
You need to implement CSS rules to hide the 4th li (the placeholder) when "prep" is selected and only show it when "school" is selected. You will also have to adjust the alignment to ensure that the plans are centered correctly.
Given your current CSS setup, here are some additions:
/* Hide the 4th li initially */
.pricing-list > li:nth-child(4) {
display: none;
}
/* Align items to the center */
.pricing-list {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
/* Ensure that when school is selected, the 4th li is displayed */
[data-type="school"].is-visible ~ .pricing-list > li:nth-child(4) {
display: block;
}
2. JavaScript Functionality:
To toggle the visibility based on the selected option between "prep" and "school", you can use JavaScript. If your current setup does not include JavaScript for toggling visibility, here’s a simple way to implement it:
document.addEventListener("DOMContentLoaded", function() {
// Listen for changes on the input elements
var switchers = document.querySelectorAll('.pricing-switcher input[type="radio"]');
switchers.forEach(function(switcher) {
switcher.addEventListener('change', function() {
var planType = this.value;
var pricingList = document.querySelector('.pricing-list');
if(planType === 'school') {
// Show the 4th li if school is selected
pricingList.classList.add('show-school');
} else {
// Otherwise, make sure it's not shown
pricingList.classList.remove('show-school');
}
// Realign items
realignItems();
});
});
function realignItems() {
var visibleItems = document.querySelectorAll('.pricing-list > li:not(.is-hidden)');
visibleItems.forEach(function(item, index) {
// Adjust alignment based on visibility - This part may need tweaking based on your exact layout
if(visibleItems.length === 4) {
item.style.flex = '25%';
} else {
item.style.flex = '33.3333%';
}
});
}
});
3. Ensuring Correct Initial State:
Make sure that the correct state is set when the page loads, based on the currently selected option (between "prep" and "school"). This may require calling the realignItems or a similar function on page load or setting an initial state through your backend template rendering.
4. Responsive Adjustments:
Remember to adjust for different screen sizes using media queries. Given your existing CSS, ensure that the display: flex;, flex-wrap:, and justify-content: center; properties work well with your design across devices.
This solution assumes a certain level of structure and functionality based on your provided HTML and CSS snippets. You may need to adjust class names, selectors, or specific property values based on your complete design setup and any existing JavaScript functionality.