嵌套手风琴菜单没有扩展到初始菜单之外



我的嵌套菜单将只停留在初始手风琴菜单的边界内,并且在打开它们时不会垂直扩展/调整大小。

如何展开嵌套的手风琴菜单容器,目前它将停留在初始手风琴菜单的边界内,无法阅读。

视频示例

<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: 1px solid;
border-color: #E7E7E7;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.6s;
}
.active, .accordion:hover {
background-color: #ccc;
}
.accordion:after {
content: '02B';
color: #777;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "2212";
}
.panel {
padding: 0 18px;
background-color: white;
max-height: 0;
overflow: hidden;
transition: max-height 0.4s ease-out;
}
</style>
</head>
<body>
<h1>Frequently Asked Questions</h1>
<button class="accordion">Online Shopping</button>
<div class="panel">
<button class="accordion">How much does delivery cost?</button>
<div class="panel">
<p>Delivery costs are calculated at the time of checkout. They vary based on the type of service or size of the vehicle required to deliver the product.</p>
</div>
<button class="accordion">How long will my delivery take?</button>
<div class="panel">
<p>When shopping online, the expected time for a click and delivery order to be completed will be communicated:
<ul>
<li>As you view the item to be added to cart.</li>
<li>In your cart prior to checkout.</li>
<li>In the order confirmation post checkout.</li>
</ul></p>
</div>
<button class="accordion">Can I cancel my order?</button>
<div class="panel">
<p>Yes, you can cancel your order in most cases. Please contact customer support at xxxx@blacksfasteners.co.nz or call 0800 xxx xxx for asssitance.</p>
</div>
<button class="accordion">Can I make changes to my order?</button>
<div class="panel">
<p>We'll always make our best effort to accommodate any changes. Please email Customer Support at xxxx@blacksfasteners.co.nz or call 0800 xxx xxx, who will endeavour to assist you with your query.</p>
</div>
<button class="accordion">My order hasn't arrived, what now?</button>
<div class="panel">
<p>If your order hasn't arrived, please contact Customer Support at xxxx@blacksfasteners.co.nz or call 0800 xxx xxx, and we'll look into it for you.</p>
</div>
<button class="accordion">Who will deliver my order?</button>
<div class="panel">
<p>We use a range of different freight and transport providers depending on the type of product and where it's being delivered.</p>
</div>
<button class="accordion">Can I change my delivery address after submitting an order?</button>
<div class="panel">
<p>Yes, you can change your delivery address. please contact Customer Support at xxxx@blacksfasteners.co.nz or call 0800 xxx xxx for assistance.</p>
</div>
<button class="accordion">I'm missing a product from my order, what should I do?</button>
<div class="panel">
<p>If you're missing a product from your order, please contact Customer Support at xxxx@blacksfasteners.co.nz or call 0800 xxx xxx for assistance.</p>
</div>
<button class="accordion">I've received the wrong item, who do I contact?</button>
<div class="panel">
<p>If you've received the wrong item, please contact Customer Support at xxxx@blacksfasteners.co.nz or call 0800 xxx xxx for assistance.</p>
</div>
<button class="accordion">Do you deliver overseas?</button>
<div class="panel">
<p>We can only deliver to New Zealand addresses.</p>
</div>
<button class="accordion">I'm having trouble ordering online, can you help me?</button>
<div class="panel">
<p>If you're having trouble buying products online, contact Customer Support at xxxx@blacksfasteners.co.nz or call 0800 xxx xxx for assistance.</p> 
</div>
<button class="accordion">Can I buy Gift Cards online?</button>
<div class="panel">
<p>Place holder text</p>
</div>
<button class="accordion">Do you offer Click & Collect?</button>
<div class="panel">
<p>Yes, a Click & Collect offer is available at all stores.</p>
</div>
</div>

<button class="accordion">Shipping & Delivery</button>
<div class="panel">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<button class="accordion">Returns Policy</button>
<div class="panel">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<button class="accordion">Your Account</button>
<div class="panel">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
} 
});
}
</script>
</body>

只需使用下面提到的Jquery for Accordion,在您的代码中,打开的Accordio高度被固定后,它就会产生问题,只需使用和嵌套代码,这样您就可以获得想要的结果

$(document).ready(function(){
$('.accordion-list > li > .answer').hide();

$('.accordion-list > li').click(function() {
if ($(this).hasClass("active")) {
$(this).removeClass("active").find(".answer").slideUp();
} else {
$(".accordion-list > li.active .answer").slideUp();
$(".accordion-list > li.active").removeClass("active");
$(this).addClass("active").find(".answer").slideDown();
}
return false;
});

});
* {
box-sizing: border-box;
}
body {
padding: 0;
margin: 0;
border: 0;
font-family: "Museo Sans", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
ul.accordion-list {
position: relative;
display: block;
width: 100%;
height: auto;
padding: 20px;
margin: 0;
list-style: none;
background-color: #f9f9fA;

li {
position: relative;
display: block;
width: 100%;
height: auto;
background-color: #FFF;
padding: 20px;
margin: 0 auto 15px auto;
border: 1px solid #eee;
border-radius: 5px;
cursor: pointer;

&.active {
h3 {
&:after {
transform: rotate(45deg);
}
}
}

h3 {
font-weight: 700;
position: relative;
display: block;
width: 100%;
height: auto;
padding: 0 0 0 0;
margin: 0;
font-size: 15px;
letter-spacing: 0.01em;
cursor: pointer;

&:after {
content: "f278";
font-family: "material-design-iconic-font";
position: absolute;
right: 0;
top: 0;
color: #Fcc110;
transition: all 0.3s ease-in-out;
font-size: 18px;
}
}

div.answer {
position: relative;
display: block;
width: 100%;
height: auto;
margin: 0;
padding: 0;
cursor: pointer;

p {
position: relative;
display: block;
font-weight: 300;
padding: 10px 0 0 0;
cursor: pointer;
line-height: 150%;
margin: 0 0 15px 0;
font-size: 14px;
}
}
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul class="accordion-list">
<li>
<h3>How much does a website cost?</h3>
<div class="answer">
<p>While we would love to be able to give a definitive, fixed price for a website, it really depends on the specific needs for each individual business. If one business needs a website comprised of five pages, while another has a substantially larger site of over 100 pages - obviously those projects are going to command different price points.</p>

<p>With that being said - here are some general guidelines on what to expect from a pricing standpoint.</p>

<p>If you can get by with a small website (between 3 - 10 pages) using a pre-designed template, you can expect to pay approximately $2,500.00. A mid-sized website that has anywhere from 11 - 25 pages, but still uses a pre-made template, will be between $3,000.00 - $5,000.00. If you have a lot of pages, are looking for something completely custom, or are looking for something that has special functionality such as eCommerce, custom calculators, or integrations with other services, you may be looking at anywhere from $10,000 - $20,000.</p>

<p>Ultimately, the takeaway here is that we can accommodate projects of just about any budget - so long as expectations are set accordingly.</p> 

</div>
</li>
<li>
<h3>Are there any monthly fees?</h3>
<div class="answer"><p>This will vary depending on the type of project. For logo & branding projects, fees will be one-time costs. For website projects, we will typically charge a monthly fee, depending on the level of service you choose. To view a full list of our monthly packages, click here.</p></div>
</li>
<li>
<h3>How much does a logo cost?</h3>
<div class="answer">
<p>Logo projects typically cost between $3,000 - $5000.</p>
<p>"Why so much?" many people ask. To answer simply - because they require a lot of work. At least, to do them properly. And of all of the investments that you will make for your business, your logo & branding is one area where you don't want to skimp.</p>

<p>In business, image is everything. And while your overall brand is based on far more than just your logo, a bad logo can create a strong first impression (for better or for worse).</p>

<p>A properly designed logo requires hours of research, and hundreds of sketches and iterations. And with an increasing number of branded businesses in the world, doing research to verify that your mark is unique is a tedious yet necessary part of the process.</p>

<p>With each logo project that we complete, we provide 3 - 5 unique logo concepts, a branding guide that details how to properly use the logo, several versions of the logo that are print-ready, and can be sent to any printer or publisher for easy use, detailed color schemes, typography & associated fonts, and design samples of your new logo.</p>

<p>Click here to learn more about how we approach our logo projects, and why we believe that we are the top logo & branding agency in the area.</p>
</div>
</li>
<li>
<h3>What separates Right Creative from other top design agencies in the area?</h3>
<div class="answer">
<p>Experience, quality, and results.</p>
<p><strong>Experience.</strong> We have been designing websites professional since the early days of the web - before CSS was mainstream, and people still used tables for their website layouts. In the 20+ years that we have been doing this, we have work with and learned from many of the top voices in several industries. To put it simply - there are very few people in the world, let alone the area that can top our years of experience.</p>

<p><strong>Quality</strong> At Right Creative, we hold an almost unrealistic standard for quality. We demand excellence in every project we take on, and firmly believe that the quality of our work demonstrates our commitment to these standards.</p>

<p><strong>Results</strong> More than anything else, our focus is, and will always be getting results for clients. We don't care how pretty something is - if it is not resulting in the growth or obtaining of goals for our clients, then it is not time or money well spent. Our mission is to turn visitors into paying customers - and every decision that we make is rooted in that mission.</p>

<p><strong>Other distinguishing features</strong> Some of the other things that separate Right Creative from other top-rated agencies are: we hand-code all of our websites for maximum results. We don't rely on Wordpress, plugins, templates or themes to accomplish things, and are therefore not locked in to the limits they pose.</p>
</div>
</li>
<li>
<h3>We're just starting out. How can we afford your services?</h3>
<div class="answer">
<p>We started this business from scratch, and know full-well how tight money can be when you are first starting out. We empathize with the struggles of new business owners, and therefore work diligently so that the new businesses that we work with succeed.</p>

<p>The primary criteria we look for when working with new businesses is the seriousness of the business owner. While it is natural for a new business owner to be cautious with the money they spend - we do look for a commitment to growth. If you do not have a specific plan for how you intend to grow your business, then the reality is - you will probably never be in a good position to afford our services.</p>

<p>With that said - if you are growth-minded, then we are happy to help you achieve that growth, and are willing to work with you to come up with a plan that fits within your budget and comfort level. Whether this is a smaller site, financing options, or a payment plan - we are confident that we can figure out something that will be mutually beneficial.</p>

</div>
</li>
<li>
<h3>What is the difference between a pre-designed site and a custom site?</h3>
<div class="answer">
<p>The difference between pre-designed and custom sites is a lot like the difference between buying a home versus building a home.</p>

<p>Pre-designed sites start with a website that has already been designed and coded. These sites will allow you to customize colors, fonts, photos, content, and your logo - but does not allow you to rearrange, reposition, or change the layout of the site. This option is great for newer businesses or businesses with a smaller budget. You not only get the benefit of a hand-coded, customized site, but you also benefit from a smaller price tag and faster turnaround time.</p>

<p>Custom sites are built from scratch, exactly to your businesses needs. While custom sites often have a bigger price tag attached to them, they are also going to be more effective at converting your visitors into paying customers.</p>

</div>
</li>
<li>
<h3>Can I make edits to my own website once it launches?</h3>
<div class="answer">
<p>Yes and no. With each client that we work with, we designate time to figure out what content clients will need to edit on a regular basis, and create tools to allow them to do that easily. For things such as news, articles, blogs, and portfolios, clients will have access to the Content Management System, and add/edit/delete those things as needed.</p>

<p>For other areas of the site, we request that our clients trust us to make those edits, so to maintain the integrity of their website.</p>

<p>It is very common for clients who have full control over their site to see it deteriorate after a while due to non-designers & non-developers adding content to the site using markup & styling that is not cohesive with the rest of the site. What results is a website filled with pages containing broken-looking content, and improperly formatted text.</p>

<p>Because we care about the quality of our sites, the reputations of our clients, and the results that they see - we prefer to let our clients be the experts at what they do - and us to be the experts at what we do.</p>

</div>
</li>
</ul>

最新更新