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: HTML SNIPPET:
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;
}
To accomplish the goal of showing only 3 list items (li) in the "prep" view and dynamically adding the 4th when switching to the "school" view (including proper center alignment and handling the new 2-year plan interference), you'll need to adjust both your CSS and JavaScript (or include JavaScript if it's not already in place). Given the structure you've provided, here are the steps and code snippets to fix the issue.
CSS Adjustments
Firstly, ensure that your CSS is set up to visually handle the "is-hidden" class appropriately and to center the items. You seem to already have styles set for .is-hidden to manage the visibility. To ensure the plans are centered, especially when showing a different number of items, your current setup with flexbox under the media query should handle it:
/* This exists in your CSS for larger screens */
@media only screen and (min-width: 768px) {
.pricing-list {
display: flex;
justify-content: center;
/* Add the below property to ensure the items are centered correctly */
flex-wrap: wrap;
}
}
JavaScript to Toggle Views and Centering
Since you need to dynamically show or hide an extra pricing plan based on the selected option, here's a basic approach using vanilla JavaScript.
JavaScript Setup
Listen for changes on the "Prep Courses" and "Nursing School" radio buttons.
When a change is detected, update the visibility of the respective pricing plans.
Also, adjust the styling if necessary to ensure correct centering.
This script initially waits for the DOM to be fully loaded. It then sets up event listeners on the radio inputs for switching between the "Prep Courses" and "Nursing School" options. Based on the selected option, it toggles the visibility of the pricing plans and adjusts the CSS flex property to ensure that the items are centered correctly.
Note: The CSS and JavaScript provided are meant as a starting point. You might need to adjust selectors, values, and styles based on the rest of your site's styling and how you've structured your HTML beyond the provided snippet. Make sure to test the behavior in various browsers and screen sizes to ensure a consistent and responsive design.