Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2012
    Posts
    25
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Accordion menu delay...

    Was hoping someone would have some insight into this: I have a pure css accordion style menu using checkboxes, not :target. This allows me to both open and close menus. I have the menu's height set to 100%. This ensures that no matter how much content I have within the menu's, they resize to fill.

    Opening a menu works great, however, when closing a menu there is a slight delay. (Half second maybe? Maybe less...). I don't have any delay in my transitions set.

    Here's the code, though it's a bit long...
    Code:
    .ac-container{
    	width: 95%;
    	margin: 10px auto 30px auto;
    	text-align: center;
    	border-radius: 10px;
    }
    
    .ac-container label{
    	font-family: Tahoma;
    	padding: 5px 20px;
    	position: relative;
    	z-index: 20;
    	display: block;
    	height: 30px;
    	cursor: pointer;
    	color: grey;
    	text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
    	line-height: 33px;
    	font-weight: bold;
    	background: #ffffff;
    	background: -moz-linear-gradient(top,  #f9b300 0%, #f9b300 1%, #f9dc90 17%);
    	background: -moz-linear-gradient(top, #f9dc90 1%, #f9b300 100%);
    	background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#ffffff), color-stop(100%,#eaeaea));
    	background: -webkit-linear-gradient(top, #ffffff 1%,#eaeaea 100%);
    	background: -o-linear-gradient(top, #ffffff 1%,#eaeaea 100%);
    	background: -ms-linear-gradient(top, #ffffff 1%,#eaeaea 100%);
    	background: linear-gradient(top, #ffffff 1%,#eaeaea 100%);
    	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eaeaea',GradientType=0 );
    	box-shadow: 
    		0px 0px 0px 1px rgba(155,155,155,0.3), 
    		1px 0px 0px 0px rgba(255,255,255,0.9) inset, 
    		0px 2px 2px rgba(0,0,0,0.1);
    }
    
    .ac-container label:hover{
    	background: #f9b300;
    }
    
    .ac-container input:checked + label,
    .ac-container input:checked + label:hover{
    	background: #f9dc90;
    	text-shadow: 0px 1px 1px rgba(255,255,255, 0.6);
    	box-shadow: 
    		0px 0px 0px 1px rgba(155,155,155,0.3), 
    		0px 2px 2px rgba(0,0,0,0.1);
    }
    .ac-container label:hover:after,
    .ac-container input:checked + label:hover:after{
    	content: '';
    	position: absolute;
    	width: 24px;
    	height: 24px;
    	right: 13px;
    	top: 7px;
    }
    
    .ac-container .ac-cats{
    	display: none;
    }
    
    .ac-container .ac-subs{
    	display: none;
    	background: red;
    }
    
    .ac-container article{
    	background: grey;
    	margin-top: -1px;
    	overflow: hidden;
    	height: 0px;
    	position: relative;
    	z-index: 10;
    	-webkit-transition: height 0.3s ease-in-out;
    	-moz-transition: height 0.3s ease-in-out;
    	-o-transition: height 0.3s ease-in-out;
    	-ms-transition: height 0.3s ease-in-out;
    	transition: height 0.3s ease-in-out;
    }
    
    .ac-container article p{
    	line-height: 30px;
    }
    
    .ac-container input:checked ~ article{
    	-webkit-transition: height 0.5s ease-in-out;
    	-moz-transition: height 0.5s ease-in-out;
    	-o-transition: height 0.5s ease-in-out;
    	-ms-transition: height 0.5s ease-in-out;
    	transition: height 0.5s ease-in-out;
    	box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.3);
    }
    
    .ac-container input:checked ~ article.ac-small{
    	height: 100%;
    }
    
    .feeds {
    	display: inline-block;
    	padding: 10px;
    	background: grey;
    	color: orange;
    }
    
    #submit_button {
    	position: relative;
    	outline: none;
    	background-color: #a5b8da;
    	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f9b300), color-stop(100%, #f9dc90));
    	background-image: -webkit-linear-gradient(top, #f9b300, #f9dc90);
    	background-image: -moz-linear-gradient(top, #f9b300, #f9dc90);
    	background-image: -ms-linear-gradient(top, #f9b300, #f9dc90);
    	background-image: -o-linear-gradient(top, #f9b300, #f9dc90);
    	background-image: linear-gradient(top, #f9b300, #f9dc90);
    	border: 1px solid #FCA800;
    	border-radius: 18px;
    	color: gray;
    	font: Tahoma;
    	padding: 3px 0;
    	text-align: center;
    	font-weight: bold;
    	width: 125px;
    	-moz-box-shadow: -1px 1px 3px #000;
    	-webkit-box-shadow: -1px 1px 3px #000;
    	box-shadow: -1px 1px 3px #000;
    	-webkit-transition: all 5s ease 0s;
    	transition: all 5s ease 0s;
    }
    
    #submit_button:hover {
    	background-color: #9badcc;
    	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #FCE167), color-stop(100%, #F7CA59));
    	background-image: -webkit-linear-gradient(top, #FCE167, #F7CA59);
    	background-image: -moz-linear-gradient(top, #FCE167, #F7CA59);
    	background-image: -ms-linear-gradient(top, #FCE167, #F7CA59);
    	background-image: -o-linear-gradient(top, #FCE167, #F7CA59);
    	background-image: linear-gradient(top, #FCE167, #F7CA59);
    	border: 1px solid #FCA800;
    	cursor: pointer;
    }
    
    #submit_button:active {
    	-webkit-box-shadow: inset 0 0 8px 2px #7e8da6, -1px 1px 3px #000;
    	box-shadow: inset 0 0 8px 2px #FCE38F, -1px 1px 3px #000;
    }
    Any help would be much appreciated.

  • #2
    New Coder
    Join Date
    Oct 2012
    Posts
    25
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Did some more testing and figured out that it was the transitions that were the problem.

    New question: when the height in .ac-container input:checked ~ article.ac-small is a set amount, say 200px, the transitions work as expected. But when I put 100%, as I have done, the transitions don't work at all. Why is this and is there a way around it?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •