jquery - Border-Bottom Accordion Panel in different browsers -
i have following jquery accordion in want have multiple sections open:
$(document).ready(function() { $(".accordion").accordion({ collapsible: true, active: false, animate: 500, }).on("click", "div", function(e) { $("div.ui-accordion-header").each(function(i, el) { if ($(this).is(".ui-state-active")) { $(this).find(".panel-icon").html("-") } else { $(this).find(".panel-icon").html("+") } }) }); });
.accordion { float: left; line-height: 2.0; width: 100%; } .js_button { width: 99%; padding-left: 1%; font-weight: bold; border-style: solid; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; margin-top: 1%; outline-width: 0; } .panel { width: 99%; height: 20%; padding-left: 1%; font-weight: bold; border-style: solid; border-left-width: 1px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; }
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> </head> <body class="body"> <div class="accordion"> <div class="js_button"><span class="panel-icon">+</span>part1</div> <span class="panel"> <p>content1</p> </span> </div> <div class="accordion"> <div class="js_button"><span class="panel-icon">+</span>part2</div> <span class="panel"> <p>content2</p> </span> </div> </body> </html>
the accordion works fine when use chrome, safari or opera have following issue border-bottom of panel (content):
when click on "button" , panel slides out border-bottom not there. in end of slide animation bordor-bottom drawn. how can avoid , let border-bottom there beginning of animation in firefox , ie?
thanks :-)
try adding border .accordion
div instead , remove other borders:
.accordion { float: left; line-height: 2.0; width: 100%; border-style: solid; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; margin-top: 1%; } .js_button { width: 99%; padding-left: 1%; font-weight: bold; outline-width: 0; position: relative; } .js_button:after { content: ""; display: block; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px; background: #000; } .panel { width: 99%; height: 20%; padding-left: 1%; font-weight: bold; overflow: hidden; }
noticed animation jerky - because using span panel. switch div (or set span display:block
) , animation should smooth above.
also, :after
above border-bottom on button. adding standard border-bottom button doubles borders, had way. sure there better way, i'll come when i'm not tired :)
Comments
Post a Comment